Skip to content
Goal: Proficient✓ Sources verified 2026-11-24SSRSSGISRuse cacheSuspense

Next.js Rendering Strategies and Caching ​

Classic interview questions: "When do SSR, SSG, ISR and streaming each fit?" and "Why isn't my data updating?" (a caching problem).

Core concepts ​

StrategyWhen HTML is generatedGood for
Static rendering (SSG)At build timeDocs, marketing pages
ISR / time-based revalidationGenerated at build time, regenerated in the background once staleLists that rarely change
Dynamic rendering (SSR)On every requestPages that depend on the user's identity or real-time data
StreamingSend the shell first, then stream each part in via Suspense as its data is readyPages with some slow queries
PPR / Cache ComponentsA static shell + dynamic holes in the same page (available via Cache Components from Next.js 16)Mostly static pages with dynamic parts

How it works ​

How the caching defaults evolved (frequently asked) ​

  • Next.js 14 and earlier: fetch was cached by default, and many people hit "my data doesn't update".
  • Next.js 15: fetch requests and GET Route Handlers are no longer cached by default; caching became opt-in.
  • Next.js 16: introduces Cache Components. After enabling cacheComponents: true in next.config.ts, you explicitly mark cacheable functions/components with the "use cache" directive, together with cacheLife (cache duration) and cacheTag / revalidateTag (invalidation by tag).

The core idea: dynamic by default, caching must be declared explicitly, which makes behavior more predictable.

Streaming and Suspense ​

tsx
export default function Page() {
  return (
    <>
      <Header />                       {/* sent immediately */}
      <Suspense fallback={<Skeleton />}>
        <SlowStats />                  {/* streamed in once its data is ready */}
      </Suspense>
    </>
  )
}

loading.tsx simply wraps the whole route segment in a Suspense boundary automatically.

In practice ​

tsx
// With Cache Components enabled: a cacheable data function
import { cacheLife, cacheTag } from 'next/cache'

export async function getRuleSet(customerId: string) {
  'use cache'
  cacheLife('hours')
  cacheTag(`rules-${customerId}`)
  return fetch(`${process.env.API_URL}/customers/${customerId}/rules`).then(r => r.json())
}
// After rules are updated: invalidate by tag in a Server Action (see the to-be-verified note for the exact API)

Recommendation for admin-style apps: render highly real-time, permissioned pages such as the task list and review console dynamically; explicitly cache only data that rarely changes, such as customer rules and dictionaries.

Common pitfalls ​

  1. Confusing the cache layers: browser HTTP cache, client router cache, server data cache and CDN are all independent. Check them one layer at a time when debugging.
  2. Reading cookies / headers inside a cached function: once user-specific data is cached, one user may see another's data.
  3. Following old tutorials: many articles online are based on Next.js 13/14 default caching behavior, which no longer applies.

Common interview questions ​

  1. When do SSR, SSG, ISR and streaming each fit?
  2. What did Next.js 15 / 16 change about default caching behavior, and why?
  3. How do "use cache" and revalidateTag work together?
  4. What role does Suspense play in server rendering?

To be verified / may go stale

  • For the signature of revalidateTag in Next.js 16 and how to use the new invalidation APIs such as updateTag / refresh, follow the current official "Caching and Revalidating" docs.
  • The Cache Components APIs are still evolving quickly.

Sources ​

Vin Amory · AI development × content creation · Technical notes cite official docs in each page’s sources section