Skip to main content
InterviewHubPRO
Section Overview
Q4

Question 4 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

8%
Next.js & App Router (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is Incremental Static Regeneration (ISR) and how does `revalidate` work?

junior LevelCode ExampleApache Kafka

In Simple Words: Historically, SSG required rebuilding the entire website whenever content changed in a CMS. ISR allows you to update static pages in the background without rebuilding the whole site:

typescript
// Revalidates this page at most once every 60 seconds
export const revalidate = 60;

export default async function ProductPage() {
  const product = await db.products.findFirst();
  return <h1>{product.name}</h1>;
}
  • Lifecycle:
    1. Requests within 60 seconds receive the cached static HTML instantly.
    2. The first request after 60 seconds still receives the cached page (stale), while Next.js triggers a background re-render.
    3. Once regenerated successfully, Next.js replaces the cache. Subsequent users get the fresh HTML.