Next.js interviews centre on rendering strategies, the App Router, server components, and caching — the parts that separate Next from plain React. Below are the most common questions with model answers. Middle: deeper understanding, optimization, and real-world situations.
Try it — no account needed
Preparing your question…
Topics to prepare
✓SSR, SSG, ISR and CSR
✓App Router vs Pages Router
✓Server components
✓Route handlers and API
✓Caching and revalidation
✓Image and font optimization
6 Middle-level questions with answers
1
How does caching work in the App Router, and what surprises people?
Answer
There are several layers: the request memo within a render, the data cache across requests, and the full route cache for static routes. What surprises people is how much is cached by default — a fetch is cached unless you say otherwise, so a page shows stale data and nobody changed anything. revalidate and cache: 'no-store' are how you opt out.
2
What is a Server Action and when would you use one?
Answer
A function marked 'use server' that a client component can call directly, with Next handling the request. It suits mutations from a form without writing an API route, and it can revalidate the affected cache in the same call. What it is not is a general RPC — it is a POST under the hood, so it is unsuitable for anything that should be a GET.
3
What is the difference between `revalidatePath` and `revalidateTag`?
Answer
revalidatePath invalidates the cache for a route; revalidateTag invalidates every fetch that was tagged, wherever it happens to be used. Tags are the better tool once the same data appears on several pages, because you stop having to remember which routes to bust when something changes.
4
What is streaming and what does `Suspense` do here?
Answer
The server sends HTML as it becomes ready instead of waiting for the slowest query. Wrapping a slow part in Suspense with a fallback lets the rest of the page arrive immediately and the slow piece stream in after. The gain is real for a page with one slow widget, and it disappears if everything is inside one boundary.
5
How do you handle an environment variable safely?
Answer
Anything prefixed NEXT_PUBLIC_ is inlined into the browser bundle and is therefore public — a key there is a key published. Everything else is server-only and accessible in Server Components, route handlers and actions. The mistake is reaching for the prefix to fix an undefined variable in a client component, which quietly ships the secret.
6
What does `generateStaticParams` do?
Answer
It tells Next which dynamic route values to prerender at build time, turning [slug] into a set of static pages. Anything not in the list is rendered on demand and can then be cached. It is what makes a content site static without giving up dynamic routing.
🦎
Reading answers is not enough
In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.