Performance: Fetch caching behavior
This affects how quickly data loads on the page and how often the browser or server fetches data again.
Jump into concepts and practice - no test required
const res = await fetch('/api/data', { cache: 'force-cache' }); const data = await res.json();
const res = await fetch('/api/data', { cache: 'no-store' }); const data = await res.json();
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Fetch with no-store cache | Minimal | 0 | Low | [X] Bad |
| Fetch with force-cache | Minimal | 0 | Low | [OK] Good |
cache: "force-cache" in a fetch call do?no-store cache mode disables caching and always fetches fresh data.fetch(url, { cache: "no-store" }) is valid and correctly disables cache.await fetch('/api/data', { cache: 'no-cache' })fetch('/api/data', { cache: 'reload' })cache: 'no-cache' serves cached data but revalidates in background; next: { revalidate: 10 } tells Next.js to re-fetch after 10 seconds.no-store disables cache completely, forcing fetch every time; force-cache caches indefinitely; default has no revalidation control.