Skip to content

Link to default route is incorrectly flagged as active #1611

@frankwallis

Description

@frankwallis

As per #1333, in 1.0.0 the recommended way for handling default routes is like this:

<Router>
  <Route component={App}>
    <Route path="/" component={DefaultView}/>
    <Route path="/eg1" component={View1}/>
    {/* ... */}
  </Route>
</Router>

But there is an issue with this related to links:

<Link to="/">Home</Link>
<Link to="/eg1">Example1</Link>

When when you are at location /eg1 both of these links will be marked as active, because Link just matches on the url. It should not be possible for 2 sibling routes to be considered active at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions