Framework
Version

useQueryClient

The useQueryClient hook returns the current QueryClient instance.

tsx
import { useQueryClient } from '@tanstack/react-query'

const queryClient = useQueryClient({ context })
import { useQueryClient } from '@tanstack/react-query'

const queryClient = useQueryClient({ context })

Options

  • context?: React.Context<QueryClient | undefined>
    • Use this to use a custom React Query context. Otherwise, defaultContext will be used.
Want to Skip the Docs?
Query.gg - The Official React Query Course
“This course is the best way to learn how to use React Query in real-world applications.”—Tanner Linsley
Get the course