Routing for Next.jss
Routing in Next.js App Router means the folders inside the app directory define URLs. A page.js file makes a folder reachable, layout.js wraps child routes, and square brackets mark dynamic segments. It sits at the base of the framework, and Link and useRouter move users between pages.
Stage: App Router Basics · Part of the Next.js roadmap · Last reviewed 19 November 2026
What to learn in Routing
- Create nested routes by adding folders with page files inside the app directory
- Share headers and sidebars across pages using layout files
- Define dynamic segments such as [id] and read them from params
- Navigate between pages with the Link component and prefetching
- Use route groups and loading or error files to organise a route tree
Routing interview questions
How does the Next.js App Router map folders to URLs?
Each folder under app becomes a URL segment, and it becomes publicly reachable only when it holds a page.js file. Folders in square brackets are dynamic, parentheses create route groups that do not affect the URL, and layout.js wraps everything below it.
What is the difference between Link and useRouter in Next.js?
Link is a component that renders an anchor and prefetches the target route when it is visible, so it suits normal navigation. useRouter is a client-side hook for programmatic moves such as push or replace after a form submit or a timer.
Where Routing fits in the Next.js roadmap
Routing belongs to the App Router Basics stage (beginner level), which takes about 16 hours. Files become routes.
Other units in this stage
Back to the full Next.js roadmap