Complete the code to set a page to revalidate every 60 seconds.
export const revalidate = [1];The revalidate export expects a number representing seconds for ISR (Incremental Static Regeneration).
Complete the code to fetch data with revalidation set to 10 seconds inside a Next.js Server Component.
const data = await fetch('https://api.example.com/data', { cache: '[1]' });
Using 'force-cache' cache mode allows Next.js to apply the revalidate setting for ISR.
Fix the error in the fetch call to enable revalidation every 30 seconds.
const res = await fetch('/api/data', { cache: '[1]' });
The 'force-cache' cache mode allows Next.js to use the revalidate time set in the page or layout.
Fill both blanks to create a fetch call that caches data and revalidates every 15 seconds.
const data = await fetch('/api/data', { cache: '[1]', next: { revalidate: [2] } });
Using 'force-cache' with next.revalidate set to 15 enables caching with revalidation every 15 seconds.
Fill all three blanks to create a Next.js page that revalidates every 20 seconds and fetches data with caching.
export const revalidate = [1]; export default async function Page() { const data = await fetch('/api/info', { cache: '[2]', next: { revalidate: [3] } }); return <pre>{JSON.stringify(data)}</pre>; }
The page sets revalidate to 20 seconds. The fetch uses 'force-cache' with next.revalidate also set to 20 to enable ISR caching.