03 / 20

What is Incremental Static Regeneration (ISR)?

ISR enables you to use static generation on a per-page basis while revalidating pages in the background as traffic comes in. Incremental Static Regeneration (ISR) enables you to:

  1. 1

    Update static content without rebuilding the entire site

  2. 2

    Reduce server load by serving prerendered, static pages for most requests

  3. 3

    Ensure proper cache-control headers are automatically added to pages

  4. 4

    Handle large amounts of content pages without long next build times

javascript
Here's how this example works:
  1. 1

    During next build, all known blog posts are generated (there are 25 in this example)

  2. 2

    All requests made to these pages (e.g. /blog/1) are cached and instantaneous

  3. 3

    After 60 seconds has passed, the next request will still show the cached (stale) page

  4. 4

    The cache is invalidated and a new version of the page begins generating in the background

  5. 5

    Once generated successfully, Next.js will display and cache the updated page

  6. 6

    If /blog/26 is requested, Next.js will generate and cache this page on-demand