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

providequeryclient.md

34 lines1.1 KB

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