Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

withHydrationKey.md

34 lines851 Bytes

Function: withHydrationKey()

function withHydrationKey(key): QueryFeature<"Hydration">;

Defined in: providers.ts:233

Sets a non-default serialization key for this injector's QueryClient cache (server dehydrate / browser hydrate via TransferState). Use this when you have multiple QueryClient instances so each has its own key. The default key applies when you do not add this feature.

providers: [
  ...provideTanStackQuery(secondaryClient, withHydrationKey('my-secondary-query-cache')),
]

Parameters

key

string

A unique string for this client's TransferState entry.

Returns

QueryFeature<"Hydration">