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

useQueryClient.md

32 lines747 Bytes

1---
2id: useQueryClient
3title: useQueryClient
4---
5​
6```ts
7function useQueryClient(queryClient?: QueryClient): QueryClient;
8```
9​
10Defined in: [packages/solid-query/src/QueryClientProvider.tsx:28](https://github.com/TanStack/query/blob/main/packages/solid-query/src/QueryClientProvider.tsx#L28)
11​
12The `useQueryClient` primitive returns the current `QueryClient` instance.
13​
14## Parameters
15​
16### queryClient?
17​
18[`QueryClient`](../classes/QueryClient.md)
19​
20Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
21be used.
22​
23## Returns
24​
25[`QueryClient`](../classes/QueryClient.md)
26​
27The current `QueryClient` instance.
28​
29## Throws
30​
31If no `queryClient` argument is passed and no `QueryClientProvider` is found in the
32component tree.