Skip to content

[Bug]: NavLink always active for root url #9261

@JulSeb42

Description

@JulSeb42

What version of React Router are you using?

6.4.0

Steps to Reproduce

Add to your navigation component and visit another page:

<NavLink to="/">Home</NavLink>

Expected Behavior

This code being compiled to

<a href="/">Home</a>

while being on any other route like /about

Actual Behavior

This is compiled to:

<a aria-current="page" class="active" href="/">Home</a>

while being on /about

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