Open History to see the last commit
1---
2id: provideQueryClient
3title: provideQueryClient
4---
5β
6```ts
7function provideQueryClient(queryClient:
8 | QueryClient
9 | InjectionToken<QueryClient>): Provider;
10```
11β
12Defined in: [packages/angular-query-experimental/src/providers.ts:21](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L21)
13β
14Usually [provideTanStackQuery](provideTanStackQuery.md) is used once to set up TanStack Query and the
15[`QueryClient`](https://tanstack.com/query/latest/docs/reference/QueryClient) for the entire application β
16it calls `provideQueryClient` internally. Use `provideQueryClient` directly to provide a different
17`QueryClient` instance for part of the application, or for unit testing.
18β
19## Parameters
20β
21### queryClient
22β
23 \| [`QueryClient`](../classes/QueryClient.md)
24 \| `InjectionToken`\<[`QueryClient`](../classes/QueryClient.md)\>
25β
26A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
27β
28## Returns
29β
30`Provider`
31β
32A provider object that can be used to provide the `QueryClient` instance.
33β
34## Example
35β
36Providing a test-only `QueryClient` in a component test, without wiring up `provideTanStackQuery`'s other
37defaults:
38```ts
39TestBed.configureTestingModule({
40 providers: [provideQueryClient(new QueryClient())],
41})
42```