Incremental Static Regeneration (ISR)
In Next.js, Incremental Static Regeneration (ISR) allows you to update static pages after deployment without requiring a full rebuild. This makes it ideal for performance and SEO on dynamic sites.
🧠How ISR Works:
- ISR enables the regeneration of static pages after the site has been deployed.
- You can define a revalidate time, which tells Next.js how often to re-generate the page in the background.
🔄 Revalidate Time
- The
revalidate
field insidegetStaticProps
specifies the number of seconds to wait before regenerating the page.
Example of ISR using getStaticProps:
- In this example, the page will be re-generated every 60 seconds in the background when a request is made after the interval.
In short:
- ISR: Combines the benefits of SSG and dynamic updates.
- Keeps pages fresh without a full rebuild.
- Great for blogs, products, and frequently updated content.