React router NavLink exact property does not work
See original GitHub issueWhen true, the active class/style will only be applied if the location is matched exactly.
<NavLink exact to="/users">
Users
</NavLink>
Expectation: It should remove the active class when a user navigates /users/:id Actual result: It removes active class
Chakra-ui implementation
<Link
as={NavLink}
to="/users"
exact
>
Users
</Link>
Expectation: It should remove the active class when a user navigates /users/:id Actual result: It doesn’t remove active class
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
NavLink exact prop not working for react-router-dom 6
The problem with NavLink of react-router-dom that i am facing now is that the root path "/" is always active, other paths are...
Read more >Fix React Router navlink-exact when activeClass is not working
If you're adding navlinks with react router because you want to set the active class you might find that it doesn't work.
Read more >NavLink - React Router: Declarative Routing for React.js
If the function className is used, the link's active state is passed as a parameter. This is helpful if you want to exclusively...
Read more >Migrating to React Router v6: A complete guide
In this article, we'll look at issues with React Router v5, what changed, how to upgrade to v6, ... Specifying exact route paths...
Read more >export 'navlink' (imported as 'navlink') was not found in 'react ...
Please try a fresh installation. There was a release (4.4) that caused a number of issues for people; that was unpublished and re-published...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is an issue with polymorphic
as
being incomplete in earlier Chakra versions. This prop now works as expected in 1.0, which is currently in pre-release status: https://codesandbox.io/s/elegant-frost-37n8n?file=/src/App.js@ljosberinn oh, sorry. I was just searching for this issue, read this discussion and saw that it isn’t solved so i just posted my problem here too. Didn’t saw that it is actually an official chakra-ui repo, my bad!