Back to results for “Caching”
Next.js › Caching

What is caching in Next.js and why is it important?

Beginner

Answer

Caching means storing the result of a data fetch or a rendered page so that future requests can reuse that saved result instead of doing the same work again. This makes your application faster and reduces the load on your database or external APIs, since repeated requests do not need to be processed from scratch.
// Next.js caches fetch requests by default in the App Router
const res = await fetch('https://api.example.com/data');
Real-world example A news website caches its homepage content for a few minutes, so thousands of visitors reading the same articles do not each trigger a fresh database query, keeping the site fast even under heavy traffic.

Common follow-ups: What are the different types of caching available in Next.js?;How do you turn off caching for data that changes very frequently?