Skip to content

[Bug]: NavLink is never active when using relative="path" #9450

Closed
@manzano78

Description

@manzano78

What version of React Router are you using?

6.4.2

Steps to Reproduce

  1. Create a data router with one route configured with this path: /contact/:id
  2. In that route's element, render a relative="path" NavLink:
    <NavLink relative="path" to="../1" className={({ isActive }) => isActive ? "active" : undefined} >Michael</NavLink>
  3. In your browser, go to the following URL: /contact/1

Expected Behavior

The generated DOM element should contain the active class: <a href="/contact/1" class="active">Michael</a>

Actual Behavior

The generated DOM element has the right href but doesn't contain the active class: <a href="/contact/1">Michael</a>, so the expected styles aren't applied.

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