Skip to content
public-library›Rules›TanStack Query›Prefetch on the server and hydrate the query cache

Prefetch on the server and hydrate the query cache

When a page is server-rendered, prefetch its queries into a QueryClient created for that request, dehydrate the cache, and hydrate it on the client, so components read the same cached data with no second fetch.

In the full rule