Question presented to candidate: "Walk me through SSG, ISR, SSR, CSR and PPR in Next.js. How do you get each one in the App Router, and how do you choose?"
What a strong answer should cover:
- SSG (static): rendered at build time and served as a file; the default for routes without request data.
- ISR: static plus regeneration after a lifetime (
revalidate) or on demand (revalidatePath,revalidateTag). - SSR (dynamic): rendered on each request, triggered by request-time APIs or uncached data; improved by streaming with Suspense.
- CSR: rendering and data fetching in the browser inside Client Components, for interactive or private parts.
- PPR (Next.js 16 with Cache Components): a static shell with dynamic holes streamed in the same response; the build shows each route mode with a symbol.
Clarifying questions expected:
- "Is the data the same for every user?" β static or ISR; otherwise dynamic or holes.
- "How fresh must it be?" β decides ISR lifetimes and on-demand revalidation.
Code / implementation expected: Yes β one route per strategy.