From the course: Master React 19 and Next.js 16 with Hands-On Projects and Real-World Applications

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Nested routes & layouts (using )

Nested routes & layouts (using )

This session demonstrates how to implement nested routes and layouts in a React application using React Router v7. You'll learn how to structure your app for better organization and create reusable layouts with shared components like navigation and footers. Let's start where we left off in the previous session. I will move each page component – Home, About, Contact, Services, Not Found – into its own file inside a new Pages directory. Let's create the Pages folder inside src and add Home.jsx, About.jsx, Contact.jsx, Services.jsx, and NotFound.jsx. Back to our code. to Home.jsx. I am moving the Home component to this file. Let's do the same thing with the About, Contact, Services, and Not Found components. Going back to app.jsx, since we moved these components to their own files, we just need to import them. Let's import them into app.jsx. To make our code more organized, let's refactor the navigation links into a reusable navbar component. Let's create the Components slash Layout…

Contents