MCPcopy
hub / github.com/TanStack/query / useQueryClient

Function useQueryClient

packages/react-query/src/QueryClientProvider.tsx:10–22  ·  view source on GitHub ↗
(queryClient?: QueryClient)

Source from the content-addressed store, hash-verified

8)
9
10export const useQueryClient = (queryClient?: QueryClient) => {
11 const client = React.useContext(QueryClientContext)
12
13 if (queryClient) {
14 return queryClient
15 }
16
17 if (!client) {
18 throw new Error('No QueryClient set, use QueryClientProvider to set one')
19 }
20
21 return client
22}
23
24export type QueryClientProviderProps = {
25 client: QueryClient

Callers 15

Example6Function · 0.90
Example7Function · 0.90
Example8Function · 0.90
Example9Function · 0.90
Example10Function · 0.90
Example6Function · 0.90
Example7Function · 0.90
Example8Function · 0.90
Example9Function · 0.90
Example10Function · 0.90
WithKnownParametersFunction · 0.90
WithIdentifiersFunction · 0.90

Calls

no outgoing calls

Tested by 1

PageFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…