Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NavLink with QueryParameter marks index as active #8348

Closed
micneuge opened this issue Nov 17, 2021 · 1 comment
Closed

[Bug]: NavLink with QueryParameter marks index as active #8348

micneuge opened this issue Nov 17, 2021 · 1 comment
Labels

Comments

@micneuge
Copy link

micneuge commented Nov 17, 2021

What version of React Router are you using?

6.0.2

Steps to Reproduce

  1. Create routing with index page, and any other page.
  2. Add NavLinks with query parameters in it.
  3. Go to page with query parameters other from index.

Example

Expected Behavior

Only active nav link is marked as active.

Actual Behavior

Active link is marked as active, and index page is marked as active as well. It makes it impossible to go to index page then.

@micneuge micneuge added the bug label Nov 17, 2021
@timdorr
Copy link
Member

timdorr commented Nov 17, 2021

You need to add a leading slash, otherwise it becomes a relative path: to="/?queryParam=true"

@timdorr timdorr closed this as completed Nov 17, 2021
brophdawg11 added a commit that referenced this issue Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants