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

provideQueryClient.md

32 lines1.0 KB

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