Open9

React がネイティブの fetch を patch しようとしてる話

azukiazusaazukiazusa

Next.js のドキュメントには次のように記載されてる

React will automatically cache fetch requests with the same input in a temporary cache. This is an optimization to avoid the same data being fetched more than once during a rendering pass - and is especially useful when multiple components need to fetch the same data.

https://beta.nextjs.org/docs/data-fetching/fundamentals#automatic-fetch-request-deduping

React が自動的に fetch request をキャッシュすると書いてある。

azukiazusaazukiazusa

fetch request をキャッシュするのは use() を使ったときのため?

azukiazusaazukiazusa

Twitter や Issue の反応を見る限り否定的な意見が多い印象

azukiazusaazukiazusa

Next.js で更に fetch を拡張しているのか

Next.js extends the options object of the fetch() function to allow each request on the server to set its own persistent caching behavior. Together with component-level data fetching, this allows you to configure caching within your application code directly where the data is being used.

https://beta.nextjs.org/docs/data-fetching/fundamentals#caching-data