Skip to main content

Data Fetching Overview

Next.js extends the native fetch API with caching and revalidation.

Server-Side Fetching

In Server Components, fetch directly:

async function getData() {
const res = await fetch('https://api.example.com/data', {
next: { revalidate: 3600 },
});
return res.json();
}

Caching Strategies

OptionBehavior
DefaultCached indefinitely
{ cache: 'no-store' }Always fresh
{ next: { revalidate: N } }Revalidate every N seconds