Compare Pages Router and App Router file-based routing conventions and capabilities
Tests your grasp of the folder-as-route paradigm shift. A strong answer notes that Pages files are routes while app folders are segments requiring page.js, and cites layout.js, loading.js, and error.js as nested primitives.
What's really being asked
This question tests whether you understand that the App Router is not a cosmetic change but a fundamental rethinking of how file system conventions map to route segments and UI boundaries. Interviewers want to see that you know Pages Router treats JavaScript files as route endpoints, while App Router treats folders as route segments and uses special files to render UI at different levels of the tree. They also want to hear that you understand the implications for layouts, loading states, error handling, and data fetching defaults.
The full answer
First, the core convention difference: in Pages Router, pages/posts/[slug].js is both the route definition and the page component, but in App Router, app/posts/[slug]/page.js is just the leaf UI inside a folder that represents the segment. Second, nested layouts: App Router lets you colocate layout.js in any route folder to create nested layouts that persist across navigation, whereas Pages Router only gives you a single _app.js and _document.js at the root. Third, segment-level primitives: App Router introduces loading.js for automatic Suspense boundaries, error.js for error boundaries, template.js for re-mounting layouts, and not-found.js for 404 handling, none of which exist as file conventions in Pages. Fourth, API patterns: Pages Router uses pages/api for API routes, while App Router uses route.js files inside the app tree to create Route Handlers. Fifth, rendering model: App Router defaults to React Server Components in page.js unless you add the use client directive, while Pages Router components are always client bundles even when server-rendered.
The mistakes people make
A major red flag is saying the App Router is just the Pages Router with an app folder instead of pages. Another is claiming dynamic route syntax changed; it did not, brackets still denote dynamic segments, but the file placement and behavior did. Candidates who say App Router removed API routes or who confuse next/router with next/navigation also signal they have not used App Router in production. Finally, describing App Router as purely a performance optimization misses the point; it is an architecture change for nested routing and server-first rendering.
What usually comes next
The interviewer may ask when you would still choose Pages Router over App Router, or how you would migrate an existing site. They might dig into how layout.js preserves state across navigation while template.js re-mounts, or ask you to explain how parallel routes and intercepting routes work as advanced App Router features. Another common follow-up is how data fetching differs: getServerSideProps and getStaticProps versus async Server Components or fetch caching semantics.
A concrete example
Imagine a dashboard at /dashboard/settings. In Pages Router, you would have pages/dashboard/settings.js and a single _app.js wrapping every page. If you wanted a dashboard shell with a sidebar, you would have to build it into the page or use a layout component manually. In App Router, you create app/dashboard/layout.js for the shell, app/dashboard/settings/page.js for the specific page, and app/dashboard/loading.js for a skeleton while settings data loads. The layout persists when the user navigates from settings to profile, and the loading state is automatically tied to that segment.
Interview question
When defining a dynamic UI route in Next.js, what is the fundamental difference between how Pages Router and App Router map the file system to the URL path?
- a.App Router changes dynamic segment syntax from brackets to named parameters, while Pages Router continues to use bracket notation.
- b.App Router uses route.js files as page components for every segment, while Pages Router relies solely on [slug].js files for dynamic paths.
- c.App Router preserves the file-as-route convention but simply renames page files to page.js inside an app folder, keeping all other behavior identical.
- d.App Router treats folders as route segments and requires page.js for the leaf UI, while Pages Router uses the JavaScript file itself as the route endpoint.Correct
Why? this is the answer
App Router uses folders as route segments and requires page.js for leaf UI, while Pages Router uses JavaScript files directly as route endpoints. Option C is tempting but wrong because App Router is not merely a folder rename; it introduces co-located segment-level primitives like layout.js and loading.js that Pages Router lacks.
Just read this? Test yourself on what you have been reading.
Read the original → nextjs.org
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on nextjs — each one lists the topics its interview covers.
See open roles