Open History to see the last commit
1---
2id: withHydrationKey
3title: withHydrationKey
4---
5β
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7β
8```ts
9function withHydrationKey(key: string): QueryFeature;
10```
11β
12Defined in: [packages/angular-query/src/providers.ts:198](https://github.com/TanStack/query/blob/main/packages/angular-query/src/providers.ts#L198)
13β
14Sets a non-default serialization key for this injector's `QueryClient` cache (server dehydrate /
15browser hydrate via `TransferState`). Use this when you have multiple `QueryClient` instances
16so each has its own key. The default key applies when you do not add this feature.
17β
18```ts
19providers: [
20 provideTanStackQuery(
21 () => new QueryClient(),
22 withHydrationKey('my-secondary-query-cache'),
23 ),
24]
25```
26β
27## Parameters
28β
29### key
30β
31`string`
32β
33A unique string for this client's `TransferState` entry.
34β
35## Returns
36β
37[`QueryFeature`](../interfaces/QueryFeature.md)
38β
39A feature that stores this client's cache under the supplied key.