I have component with a react router v4 to anohter component, i want to add another routes in the second component.
this is the main route:
const Dashboard = () => {
return (
<div>
<Header/>
<Router>
<div>
<Route path="/" exact component={Wall} />
<Route path="/challenge/:id" component={Challenge} />
</div>
</Router>
</div>
)
}
and this is the Challenge component:
class Challenge extends Component {
...
render() {
return (
...
<Router>
<div>
<Route path="/overview" exact component={Overview} />
<Route path="/discussions" exact component={Discussions} />
</div>
</Router>
...
)
}
}
and this is not working for me..
The only option that works is to include the /challenge/:id inside the challenge component:
<Route path="/challenge/:id/overview" exact component={Overview} />
<Route path="/challenge/:id/discussions" exact component={Discussions} />
in the end i want to make the route look like this for example:
www.site.com/challenge/1/overview
www.site.com/challenge/1/discussions
But without containing the full route within each nested route.