August 2017
Beginner
374 pages
10h 41m
English
With dynamic routing, nesting can simply be done by nesting the Route components.
For example, if we wanted to implement a /posts/:id page, we could define the sub-route in the PostsPage, as follows:
const PostsPage = ({ match }) => <div> <Route path={match.url + '/:id'} component={PostPage} /> </div>
We need to use match.url here to get the relative path from the previous route (in this case, /posts).
Read now
Unlock full access