Nested routes with folders
📖 Scenario: You are building a simple website with multiple pages organized in folders to create nested routes.This helps visitors navigate easily and keeps your code neat.
🎯 Goal: Create nested routes in a Next.js app using folders inside the app directory.Build a homepage, an about page inside an about folder, and a contact page inside a contact folder.
📋 What You'll Learn
Create a homepage at
app/page.tsx with a heading 'Home Page'.Create an
about folder inside app with a page.tsx file showing heading 'About Us'.Create a
contact folder inside app with a page.tsx file showing heading 'Contact Us'.Use React functional components with default exports for each page.
💡 Why This Matters
🌍 Real World
Websites often have multiple pages grouped by topic or function. Using nested folders for routes keeps code organized and URLs user-friendly.
💼 Career
Understanding Next.js routing and folder structure is essential for building scalable React applications and working in modern web development teams.
Progress0 / 4 steps