Revalidation is the process of updating cached or statically generated pages after a set time or event, so users see fresh content without rebuilding the whole site.
Click to reveal answer
beginner
What does the revalidate property do in Next.js getStaticProps?
It sets the number of seconds after which a page will be regenerated in the background when a request comes in, enabling Incremental Static Regeneration.
Click to reveal answer
intermediate
Explain Incremental Static Regeneration (ISR) in Next.js.
ISR lets Next.js update static pages after build time by regenerating them on-demand in the background, so users get fast pages with fresh data.
Click to reveal answer
intermediate
How does On-Demand Revalidation work in Next.js?
It allows you to manually trigger a page regeneration via an API route, so you can update pages immediately after data changes without waiting for the timer.
Click to reveal answer
advanced
What is the difference between revalidate and cache-control headers in Next.js?
revalidate controls how often Next.js regenerates static pages, while cache-control headers control browser or CDN caching behavior for responses.
Click to reveal answer
What does setting revalidate: 10 in getStaticProps do?
ARegenerates the page every 10 minutes
BRegenerates the page every 10 seconds on the server when requested
CPrevents the page from regenerating
DCaches the page in the browser for 10 seconds
✗ Incorrect
The revalidate value is in seconds and tells Next.js to regenerate the page in the background if a request comes after 10 seconds.
Which Next.js feature allows manual triggering of page regeneration?
AOn-Demand Revalidation
BStatic Generation
CServer-Side Rendering
DClient-Side Rendering
✗ Incorrect
On-Demand Revalidation lets you call an API route to manually trigger regeneration of static pages.
What happens if you don't set revalidate in getStaticProps?
AThe page is generated once at build time and never updated automatically
BThe page regenerates on every request
CThe page is regenerated every second
DThe page is deleted after build
✗ Incorrect
Without revalidate, Next.js generates the page only once during build and serves that static page forever.
Which header controls browser caching behavior independently of Next.js revalidation?
Arevalidate
Bcontent-type
Ccache-control
Detag
✗ Incorrect
cache-control headers tell browsers and CDNs how long to cache responses.
DServing static pages quickly and updating them in the background
✗ Incorrect
ISR serves static pages fast and regenerates them in the background to keep content fresh.
Describe how Next.js uses the revalidate property to keep static pages fresh.
Think about how Next.js updates pages after build without slowing down users.
You got /4 concepts.
Explain the difference between automatic revalidation and on-demand revalidation in Next.js.
One happens by itself after some time, the other happens when you tell it to.
You got /4 concepts.
Practice
(1/5)
1. What does the revalidate export in Next.js control?
easy
A. How often a cached page updates after initial generation
B. The maximum number of pages to cache
C. The delay before a page is first generated
D. The priority of server-side rendering
Solution
Step 1: Understand the role of revalidate
The revalidate export sets the time in seconds for Next.js to update a cached page after it was first generated.
Step 2: Compare options with this behavior
Only How often a cached page updates after initial generation correctly describes this update frequency control. Other options describe unrelated concepts.
Final Answer:
How often a cached page updates after initial generation -> Option A
Quick Check:
Revalidate controls update frequency = D [OK]
Hint: Remember revalidate sets cache update time in seconds [OK]
Common Mistakes:
Confusing revalidate with cache size
Thinking revalidate delays first page generation
Mixing revalidate with rendering priority
2. Which of the following is the correct syntax to set a page to revalidate every 60 seconds in Next.js?
easy
A. export revalidate = 60;
B. export const revalidate = 60;
C. const revalidate = 60 export;
D. export const revalidate(60);
Solution
Step 1: Recall correct export syntax in Next.js
To export a constant, the syntax is export const name = value;.
Step 2: Match this with revalidate usage
export const revalidate = 60; matches this pattern exactly. Other options have syntax errors or misplaced keywords.
Final Answer:
export const revalidate = 60; -> Option B
Quick Check:
Correct export syntax = A [OK]
Hint: Use 'export const' to export revalidate value [OK]