Consider a Next.js page that uses export const revalidate = 10; for full route caching. What happens when a user visits the page multiple times within 10 seconds?
export const revalidate = 10; export default function Page() { const time = new Date().toISOString(); return <p>Current time: {time}</p>; }
Think about how Next.js uses the revalidate property to control cache duration.
Setting revalidate = 10 tells Next.js to cache the page for 10 seconds. Within that time, the cached page is served. After 10 seconds, Next.js regenerates the page on the next request.
Choose the correct way to enable full route caching with a 60-second revalidation period in a Next.js page.
Check the official Next.js syntax for revalidation.
The correct syntax to set full route cache revalidation is export const revalidate = 60;. Other options are either invalid or incomplete.
Given the code below, the page shows a new time on every request despite revalidate set to 30. What is the most likely cause?
export const revalidate = 30; export default function Page() { const time = new Date().toISOString(); return <p>Time: {time}</p>; }
Consider the difference between client and server components in Next.js caching.
Full route caching with revalidate only works on server components. If the page is a client component, caching does not apply.
export const revalidate = 0; in a Next.js page?In Next.js, what is the effect of setting export const revalidate = 0; in a page component?
Think about what zero seconds means for caching duration.
Setting revalidate = 0 disables caching, so the page regenerates on every request.
A Next.js page exports export const revalidate = 20; and renders the current time. The page is first requested at 12:00:00 and cached. What time will the page show if requested again at 12:00:15?
export const revalidate = 20; export default function Page() { const time = new Date().toISOString(); return <p>Time: {time}</p>; }
Recall how revalidation timing affects cached page output.
The page is cached for 20 seconds, so a request at 15 seconds returns the cached output from 12:00:00.