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

useQueryClient.md

36 lines875 Bytes

function useQueryClient(queryClient?: QueryClient): QueryClient;

Defined in: packages/react-query/src/QueryClientProvider.tsx:21

The useQueryClient hook returns the current QueryClient instance.

Parameters

queryClient?

QueryClient

Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.

Returns

QueryClient

The current QueryClient instance.

Throws

If no queryClient argument is passed and no QueryClientProvider is found in the component tree.