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

provideQueryClient.md

30 lines979 Bytes

1---
2id: provideQueryClient
3title: provideQueryClient
4---
5​
6```ts
7function provideQueryClient(queryClient): Provider;
8```
9​
10Defined in: [providers.ts:14](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L14)
11​
12Usually [provideTanStackQuery](provideTanStackQuery.md) is used once to set up TanStack Query and the
13[https://tanstack.com/query/latest/docs/reference/QueryClient\|QueryClient](https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient)
14for the entire application. Internally it calls `provideQueryClient`.
15You can use `provideQueryClient` to provide a different `QueryClient` instance for a part
16of the application or for unit testing purposes.
17​
18## Parameters
19​
20### queryClient
21​
22A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
23​
24`QueryClient` | `InjectionToken`\<`QueryClient`\>
25​
26## Returns
27​
28`Provider`
29​
30a provider object that can be used to provide the `QueryClient` instance.