Static Reactions Demo
Reactions on this GitHub issue:
๐ 1993
๐ 330
๐ 499
๐ 417
๐ 225
๐งก 561
๐ 507
๐ 548
Explanation: This page is statically generated with Next.js by fetching data from GitHub. Itโs deployed to Vercelโs Edge Network (CDN). Importantly, this page is being re-generated using Incremental Static Regeneration (released in Next.js 9.5). Hereโs how it works:
- Each Next.js page can define the timeout. For this page, itโs set at 1 second.
- When a new request comes in, the statically generated page is served.
- Later, when another request comes in after the defined timeout is exceeded: (1) The statically generated page is served, and (2) Next.js generates a new version of the page in the background and updates the static page for *future* requests.
- Later, when another request comes in after the regeneration is done: The updated static page is served.
- This allows Incremental Static Regeneration on a per-page basis without rebuilding the full app. Itโll always be fast because users will always get a static response. Learn more here.
Source: pages/index.js - `getStaticProps()` fetches the data during static generation, and `revalidate` specifies the timeout.