Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Router parent ".active" class not active when child router loaded

This is how the routes are set up:

var RRoutes = (
<Route handler={App}>

    <Route name="home" path="/" handler={Page} />

    <Route name="portfolio" path="portfolio">
        <DefaultRoute handler={Page} />
        <Route name="portfolio.items" path=":page" handler={test} />
    </Route>

    <Route name="pages" path=":page" handler={Page} />


</Route>
);

When "/portfolio" page is loaded the link gets active. If the child route "portfolio.items" is loaded, the parent active link disappears.. Any suggestions how to get this to work?

like image 933
Martyboy Avatar asked Sep 27 '22 02:09

Martyboy


1 Answers

Turns out the problem was that I used "/portfolio" instead of "portfolio"

<Link to="portfolio">

Answered by taurose in github. https://github.com/rackt/react-router/issues/1684

like image 137
Martyboy Avatar answered Oct 02 '22 16:10

Martyboy