Skip to the solution
MediumFrontend6 min read

What are the rendering strategies in Next.js (SSR, SSG, ISR, CSR)?

450 views

The problem

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.

  • nextjs
  • rendering
  • ssr
  • ssg
  • isr

Try it yourself

Sketch your approach before you read the solution. That is what the interview tests.

Stuck? Get a hint.

A short nudge toward the approach. It will not give the answer away.

Solution

The solution is hidden so you can try first

6 min read Β· 8 sections

Read the code

One route per strategy
// SSG: app/about/page.tsx
export default function About() { return <h1>About us</h1>; }

// ISR: app/news/page.tsx
export const revalidate = 300;
export default async function News() { const n = await getNews(); return <List items={n} />; }

// SSR: app/account/page.tsx
import { cookies } from "next/headers";
export default async function Account() { const user = await getUser((await cookies()).get("sid")?.value); return <p>{user.name}</p>; }

// CSR: components/Live.tsx
"use client";
import useSWR from "swr";
export function Live() { const { data } = useSWR("/api/live", (u) => fetch(u).then((r) => r.json())); return <p>{data?.value ?? "..."}</p>; }

// PPR (next.config: cacheComponents: true): static shell + <Suspense><Personal /></Suspense>

Discussion

Other approaches, follow-ups and how it went in real interviews.

Sign in to join the discussion.

No comments yet. Share how you would answer it.

Question 77 of 129 in Next.js

Keep your momentum going.

Mark this question solved to track your progress, then take the next one while it is fresh.

All Next.js questions
Up nextMedium

What is ISR (Incremental Static Regeneration) in Next.js and how do you implement it?

Continue