Nested routes and dynamic routing

The earlier versions of React-Router required the routes to be defined upfront, and the child routes to be nested inside another route, as seen here:

<Router>    <Route path='/' component={Container}>        <IndexRoute component={Home} />        <Route path='user' component={User}>            <IndexRoute component={Twitter} />            <Route path='instagram' component={Instagram} />        </Route>    </Route></Router>

This code can be considered static routing, wherein the route configuration is required by the library when the application initializes. Here, the route with the '/' path serves as the parent of all the routes, and the route with the 'user' path is a child route of '/', and a parent route for the route with the 'instagram' path.

In React-Router ...

Get React Router Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.