Skip to main content
InterviewHubPRO
Section Overview
Q8

Question 8 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

16%
Next.js & App Router (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

How does File-Based Routing work in the App Router?

junior LevelRouting

In Simple Words: Special reserved filenames inside app/ define the UI hierarchy:

  • page.tsx: Makes the route publicly accessible and defines its unique UI.
  • layout.tsx: Shared UI wrapping the page and its child routes. Preserves state across navigations (does not re-render).
  • loading.tsx: Automatically wraps page.tsx in a React <Suspense> boundary to display an instant skeleton loader.
  • error.tsx: React Error Boundary that catches runtime errors and shows a fallback UI without breaking the parent layout. (Must be a Client Component).
  • not-found.tsx: Rendered when notFound() is invoked or a route does not match.