Challenge - 5 Problems
Next.js Revalidation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when using
revalidate: 10 in Next.js?Consider a Next.js page using
export const revalidate = 10;. What is the behavior of this page after the first request?NextJS
export const revalidate = 10; export default function Page() { return <p>Current time: {new Date().toISOString()}</p>; }
Attempts:
2 left
💡 Hint
Think about how Next.js uses the revalidate time to update static pages.
✗ Incorrect
Setting revalidate to 10 means Next.js will serve the cached page and regenerate it in the background at most once every 10 seconds after a request triggers regeneration.
📝 Syntax
intermediate1:30remaining
Identify the correct way to set time-based revalidation in Next.js 14
Which of the following code snippets correctly sets a 30-second revalidation time for a Next.js page using the App Router?
Attempts:
2 left
💡 Hint
Check the type and value expected for revalidate in Next.js.
✗ Incorrect
The revalidate export expects a number representing seconds. So 30 means 30 seconds.
🔧 Debug
advanced2:30remaining
Why does the page never update despite
revalidate set?A developer sets
export const revalidate = 60; in a Next.js page but notices the page content never updates after deployment. What is the most likely cause?Attempts:
2 left
💡 Hint
Consider how Next.js handles data fetching methods in the App Router.
✗ Incorrect
In the App Router,
getStaticProps is not used. Instead, revalidate is set as an export in the page or layout. Using getStaticProps there has no effect.❓ state_output
advanced2:00remaining
What is the output behavior of ISR with
revalidate: 0?If a Next.js page has
export const revalidate = 0;, what will be the behavior when users request the page?NextJS
export const revalidate = 0; export default function Page() { return <p>Time: {new Date().toISOString()}</p>; }
Attempts:
2 left
💡 Hint
Think about what 0 seconds means for revalidation timing.
✗ Incorrect
A revalidate value of 0 means the page is regenerated on every request, so the content is always fresh.
🧠 Conceptual
expert3:00remaining
How does Next.js handle concurrent requests during revalidation?
When a Next.js page with
revalidate: 10 is requested by multiple users at the same time after the cache expires, how does Next.js handle regeneration to avoid multiple builds?Attempts:
2 left
💡 Hint
Consider how Next.js optimizes regeneration to reduce server load.
✗ Incorrect
Next.js uses a background regeneration approach where only one regeneration happens, and other requests get the stale page until the new one is ready.