Next.js: Cache a fetch request
13 June 2025 (Updated 13 June 2025)
By default, fetch
requests aren’t cached but you can easily cache them like so:
export default async function Page() {
const data = await fetch('https://...', { cache: 'force-cache' })
}
You can also specify how long to cache the request for in seconds:
export default async function Page() {
const data = await fetch('https://...', { next: { revalidate: 3600 } })
}
See the fetch
API reference to learn more.
Links
Tagged:
Next.js recipes