You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
It seems that the active states of NavItems are being incorrectly set when using react-router.
No need to supply my own code to show this as the issue is present in the example section of this repository.
When most pages are being accessed, it shows both the Home page and the currently selected page as active. For example, in this gallery page, both the Gallery page NavItem and the Home page NavItem are active.
To me, without analysing the repository code, it looks as if the system to show which NavItem is active checks the NavItem paths to see if they contain the current path. I do not believe this should be the case as it causes paths such as / and /blog to both be shown as active when only one should be active at a time. However, this should be the case for all sublinks / links in the dropdowns from the navbar.
The text was updated successfully, but these errors were encountered:
Done some more experimenting, it seems that the active state is being passed correctly to the Nav.Link component, but it's children something goes wrong. That seems to do with React Router's exact prop not being present.
Edit:
As I suspected when adding exact to RootComponent in the NavLink component file it renders correctly.
Hello all,
It seems that the active states of
NavItems
are being incorrectly set when using react-router.No need to supply my own code to show this as the issue is present in the example section of this repository.
When most pages are being accessed, it shows both the Home page and the currently selected page as active. For example, in this gallery page, both the Gallery page
NavItem
and the Home pageNavItem
are active.To me, without analysing the repository code, it looks as if the system to show which
NavItem
is active checks theNavItem
paths to see if they contain the current path. I do not believe this should be the case as it causes paths such as/
and/blog
to both be shown as active when only one should be active at a time. However, this should be the case for all sublinks / links in the dropdowns from the navbar.The text was updated successfully, but these errors were encountered: