Demo
Cached React Server Components
- Mark an individual React Server Component as cacheable by adding the
use cachedirective to the top of the function definition. - When a cacheable component is called with the same inputs, it reuses the cached result if it exists, otherwise it renders and caches the output.
app/page.tsx
1async function ProductList() {2'use cache';3// ...4}56export default async function Page() {7return <ProductList />;8}
Demo
- A product list component is annotated with
use cache. - An artificial one second delay is added to make the difference more noticeable.
- Since the component is cacheable, the delay only happens the first time the component is rendered.
layout.tsxandpage.tsxaren't explicitly annotated withuse cache, but Next.js infers they're static because they do not use any Dynamic APIs. If they started to, Next.js will guide the developer to either adduse cacheor a<Suspense>boundary.
Notes
- This demo uses the experimental
use cachedirective and describes caching behavior once stable.
layout.tsx (statically inferred)
page.tsx (statically inferred)
<ProductList> (Cacheable)
All (9)








