Back to results for “Caching”
Next.js › Rendering (SSR/SSG/ISR)

How does incremental static regeneration let you get the benefits of both static pages and fresh content?

Intermediate

Answer

Incremental static regeneration serves the existing fast, cached static page to visitors while a new version is being generated in the background after the revalidation period passes, so the current visitor never waits for a rebuild, and the next visitor after that automatically sees the updated content once it is ready.
// This page will regenerate at most once every 300 seconds
const res = await fetch('https://api.example.com/products', {
  next: { revalidate: 300 }
});
Real-world example A large e-commerce catalog uses incremental static regeneration so product pages stay fast for every visitor while automatically refreshing their prices and stock levels every few minutes in the background.

Common follow-ups: What happens to a visitor while a page is being regenerated in the background?;How does incremental static regeneration differ from on-demand revalidation?