MCPcopy Create free account
hub / github.com/TanStack/query / useQueryClient

Function useQueryClient

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

Source from the content-addressed store, hash-verified

18 * component tree.
19 */
20export const useQueryClient = (queryClient?: QueryClient) => {
21 const client = React.useContext(QueryClientContext)
22
23 if (queryClient) {
24 return queryClient
25 }
26
27 if (!client) {
28 throw new Error('No QueryClient set, use QueryClientProvider to set one')
29 }
30
31 return client
32}
33
34/**
35 * The props accepted by `QueryClientProvider`.

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