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

useQueryClient.md

30 lines800 Bytes

1---
2id: useQueryClient
3title: useQueryClient
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8```ts
9function useQueryClient(): QueryClient;
10```
11​
12Defined in: [packages/lit-query/src/context.ts:105](https://github.com/TanStack/query/blob/main/packages/lit-query/src/context.ts#L105)
13​
14Resolves the current default `QueryClient` registered by a connected
15`QueryClientProvider`.
16​
17This helper is useful outside a Lit reactive controller when a single
18provider is mounted. It throws if no client is registered or if multiple
19clients are mounted and the default would be ambiguous.
20​
21## Returns
22​
23[`QueryClient`](../classes/QueryClient.md)
24​
25The single registered query client.
26​
27## Throws
28​
29If no `QueryClient` is registered, or if multiple are
30mounted and the default is ambiguous.