Add Index and Layout Routes

Add index, layout, and nested routes in a React application.

In this lesson, we’ll cover how to implement the nested, index, and layout routes in our project.

Using nested routes

At present, our <Navbar /> component is rendering outside of the routes. We can use nested routes to give the parent component (the Wrapper / component, in this case) more control over its child components. Let’s open the file called Wrapper.js from the coding widget given in the exercise section and add the following code:

Get hands-on with 1200+ tech skills courses.