Skip to content

Dealing with Button as a NavLink of react router gives a react warning #2295

@sharno

Description

@sharno

Steps

Add a NavLink from react-router to a button, ex:
<Button as={NavLink} to={"/members/" + user.id}>Click</Button>

Expected Result

no warnings

Actual Result

Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.

Check the render method of `Button`.
    in NavLink (created by Button)
    in Button (at MembersPendingAssignments.js:35)

Version

0.75.1

Testcase

https://codesandbox.io/s/8xm89o4j3l

Is it a bug or I shouldn't use the button this way? Any alternatives to get a button working as a link that changes in styling or should I manage the styling manually and use just a Link instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions