What is ISR?
ISR (Incremental Static Regeneration) is a feature provided by Next.js. In simple terms, it's a system that generates static pages in advance and automatically updates them when needed.
How ISR Differs from Other Approaches
There are several methods for generating web pages.
SSG (Static Site Generation)
All pages are generated as static HTML at build time. Display is very fast, but a rebuild is required every time content is updated. For EC sites with many products, build times can become lengthy.
SSR (Server-Side Rendering)
HTML is generated on the server each time a user accesses the page. This always displays the latest data, but server processing occurs on every request, resulting in wait times before display.
ISR
ISR combines the best of SSG and SSR. Static pages are generated at build time and automatically updated at set intervals (revalidate). Users receive fast cached responses while pages are updated with the latest data in the background.
When ISR is Suitable
ISR is effective in the following scenarios:
- EC site product pages: Inventory and prices change, but instant updates aren't required
- Blogs and news: New articles are added regularly, but changes after publication are rare
- Corporate websites: Information is updated periodically, but real-time updates aren't needed
Conversely, ISR is not suitable for chat applications or real-time stock prices where the latest data is always required.
Summary
ISR is a system that achieves both fast display and fresh data. It's suitable for content that updates periodically, like EC sites, where you want to deliver fast experiences.