Interview Q&A · questions with model answers

Next.js Developer Interview Questions

Part of the study plan for: Frontend Engineer · Full Stack Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked What is Next.js and what problems does it solve on top of React?

    Next.js is a React framework that adds file-based routing, server rendering (SSR, static generation, streaming), React Server Components, data fetching and caching, API endpoints (Route Handlers),…

  2. Most asked What are the differences between the App Router and the Pages Router?

    The App Router (app/ directory, stable since Next.js 13.4) is built on React Server Components with nested layouts, streaming, Server Actions and colocated loading/error UI. The Pages Router…

  3. Most asked What are Server Actions and how do you use them for mutations?

    Server Actions are async functions marked with 'use server' that run on the server and can be called from forms (<form action={createPost}>) or Client Components. Next.js handles the network…

  4. Most asked What is Next.js middleware (renamed `proxy` in Next.js 16) and what should it be used for?

    Middleware (middleware.ts, called proxy.ts from Next.js 16) runs before a request is matched to a route, so it can rewrite, redirect, set headers/cookies or return early. It's good for lightweight…

  5. Most asked What does `next/image` do?

    <Image> automatically resizes, optimizes and serves modern formats (WebP/AVIF), lazy-loads images by default, prevents layout shift by requiring dimensions (or fill), and generates responsive srcsets.

  6. What are route groups, parallel routes and intercepting routes?

    Route groups (name) organize files or apply different layouts without affecting the URL; parallel routes @slot render multiple pages in the same layout simultaneously; intercepting routes…

  7. What are `usePathname`, `useSearchParams` and `useParams`, and what's the Suspense caveat?

    They're Client Component hooks from next/navigation that read the current path, query string and dynamic params. Calling useSearchParams() in a statically rendered route forces client-side rendering…

  8. What are the options for deploying a Next.js application?

    Deploy to Vercel (zero-config), self-host with next start on a Node server, build a Docker image using output: 'standalone', use adapters for other platforms (Netlify, AWS via OpenNext, Cloudflare),…

  9. What is a Data Access Layer (DAL) and why is it recommended in Next.js?

    A DAL is a server-only module that centralizes data fetching and authorization: every function verifies the current session/permissions and returns minimal DTOs, so pages, layouts and Server Actions…

  10. What security considerations apply specifically to Server Actions and Server Components?

    Server Actions are public POST endpoints (their IDs are discoverable), so validate input and authorize every call; closures can capture values that become encrypted but still sent to the client; and…

  11. What is the RSC payload?

    The React Server Component payload is a compact serialized representation of the rendered Server Component tree (rendered output, placeholders for Client Components with references to their JS, and…

  12. What does `next/font` provide?

    next/font self-hosts Google or local fonts at build time, eliminating external network requests, and uses CSS size-adjust fallbacks to avoid layout shift, while exposing a className or CSS variable.

  13. What is `useOptimistic` and how does it work with Server Actions?

    useOptimistic(state, updateFn) returns a temporary state that you update immediately when a mutation starts (e.g., showing a new comment); once the Server Action completes and fresh server data…

  14. What is Turbopack?

    Turbopack is Next.js's Rust-based incremental bundler, the successor to Webpack in Next.js. It's stable for next dev since Next.js 15 and became the default bundler for dev and build in Next.js 16.

  15. What is Partial Prerendering (PPR) / Cache Components?

    Partial Prerendering serves a static shell of a route instantly (from the build or edge cache) while dynamic parts inside <Suspense> boundaries stream in at request time, combining static speed with…

  16. What does the `'use cache'` directive do?

    'use cache' (Cache Components) marks a component, function or whole file as cacheable: its return value is cached based on its serializable inputs, with lifetime controlled by cacheLife('hours') and…

  17. What is the `after()` API in Next.js 15?

    after(callback) schedules work (logging, analytics, cache warming) to run after the response has finished streaming, without delaying the user. It can be used in Server Components, Server Actions,…

  18. What styling options work with the App Router and Server Components?

    CSS Modules, global CSS, Tailwind CSS and Sass work out of the box with Server Components. CSS-in-JS libraries that rely on runtime context (styled-components, Emotion) require Client Components and…

  19. What does `generateStaticParams` do and what is `dynamicParams`?

    generateStaticParams returns the list of params to pre-render at build time for a dynamic route. export const dynamicParams = true (default) renders unknown params on demand and caches them; false…

  20. What are route segment config options?

    Exports from a page, layout or route handler that control behavior: dynamic ('auto' | 'force-dynamic' | 'force-static' | 'error'), revalidate, dynamicParams, runtime ('nodejs' | 'edge'),…

  21. What does Next.js do for accessibility, and what remains your job?

    Next.js announces route changes to screen readers via its route announcer, the ESLint config includes jsx-a11y rules, and next/image requires alt. Semantic HTML, focus management, color contrast and…

  22. What is `output: 'export'` and what are its limitations?

    It generates a fully static site (HTML/CSS/JS) deployable to any static host. Features needing a server don't work: Server Actions, ISR, middleware, cookies/headers-based rendering, Route Handlers…

  23. What is the `next/form` component?

    <Form> from next/form (Next.js 15) extends the HTML form: for GET forms with a string action (like search), it prefetches the target route and performs client-side navigation with the form values as…

  24. What do the `server-only` and `client-only` packages do?

    Importing server-only in a module causes a build error if that module is ever imported into client code, which protects secrets and server logic; client-only does the reverse for browser-only modules.

  25. What breaking changes should you expect when upgrading to Next.js 15?

    Async request APIs (await cookies(), headers(), draftMode(), params, searchParams), uncached-by-default fetch and GET Route Handlers, client Router Cache changes, React 19 as the minimum for the App…

  26. What are notable changes in Next.js 16?

    Next.js 16 made Turbopack the default bundler, introduced Cache Components ('use cache' with PPR) as the caching model, renamed middleware to proxy, refined caching APIs (revalidateTag with…

  27. What is Draft Mode and how is it used with a headless CMS?

    Draft Mode lets editors preview unpublished content on statically generated pages: a Route Handler enables it ((await draftMode()).enable()) after verifying a secret, which sets a bypass cookie so…

  28. What is required in the root layout of an App Router app?

    The root app/layout.tsx must define the <html> and <body> tags and render children; it replaces the Pages Router's _app and _document.

  29. What is the React Compiler and how does it relate to Next.js?

    The React Compiler automatically memoizes components and hooks at build time, reducing the need for manual useMemo, useCallback and React.memo. Next.js supports enabling it via the reactCompiler…

  30. What do the symbols in `next build` output (○, ●, ƒ) mean?

    ○ (Static) routes are prerendered as static content, ● (SSG) routes are prerendered using generateStaticParams/getStaticProps, and ƒ (Dynamic) routes are server-rendered on demand. Newer versions…

Was this page helpful?

Report a mistake