Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Important
Security Advisory: React2Shell & two new vulnerabilities
Find out more

cacheComponents

Last updated October 22, 2025

ThecacheComponents flag is a feature in Next.js that causes data fetching operations in the App Router to be excluded from pre-renders unless they are explicitly cached. This can be useful for optimizing the performance of dynamic data fetching in Server Components.

It is useful if your application requires fresh data fetching during runtime rather than serving from a pre-rendered cache.

It is expected to be used in conjunction withuse cache so that your data fetching happens at runtime by default unless you define specific parts of your application to be cached withuse cache at the page, function, or component level.

Usage

To enable thecacheComponents flag, set it totrue in yournext.config.ts file:

next.config.ts
importtype { NextConfig }from'next'constnextConfig:NextConfig= {  cacheComponents:true,}exportdefault nextConfig

WhencacheComponents is enabled, you can use the following cache functions and configurations:

Notes

  • WhilecacheComponents can optimize performance by ensuring fresh data fetching during runtime, it may also introduce additional latency compared to serving pre-rendered content.

Version History

VersionChange
16.0.0cacheComponents introduced. This flag controls theppr,useCache, anddynamicIO flags as a single, unified configuration.

Was this helpful?

supported.

[8]ページ先頭

©2009-2025 Movatter.jp