I can't solve this problem, I can't render the HTML of my component
that i call from a nested path
like /page/detail
My route tree
render(
(<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Index}/>
<Route path="page" component={Page}>
<Route path="/page/detail" component={Detail} />
</Route>
</Route>
</Router>),
document.getElementById('main')
)
My {App} component renders this:
render() {
return (
<div>
<nav className="navbar">
<ul className="nav navbar-nav navbar-right">
<li><Link className="menu-link" ref="menu" to="/page">Page Test</Link></li>
</ul>
</nav>
<div id="content-wrapper">{this.props.children}</div>
</div>
)
}
My route /page/detail
is called from a Link
inside the component {Page}
but if i access to this link i see only what {Page} component renders. I've searched for some solution about nested routes with react-routers but i didn't find an answer.
UPDATE:
By this solution i've rendered my {Detail} component's html: I've inserted this within {Page} component
{this.props.children || <div>My Detail page</div> }
UPDATE 2
In my {Page} component I've inserted a jQuery plugin.
mix() {
$("#filter-gallery").mixItUp();
}
destroy() {
$('#filter-gallery').mixItUp('destroy');
}
componentDidMount() {
this.mix();
}
componentWillUnmount() {
this.destroy();
}
This plugin works only at {Page} refresh page, if i navigate to /page/detail and then come back to /page the plugin doesn't work.
I've find a solution by setting routes in this way: