Docs
Cloudflare
CodeRabbit
Railway
AG Grid
Clerk
SerpAPI
WorkOS
OpenRouter
Netlify
Sentry
Electric
Prisma
Unkey
Cloudflare
CodeRabbit
Railway
AG Grid
Clerk
SerpAPI
WorkOS
OpenRouter
Netlify
Sentry
Electric
Prisma
Unkey
API Reference

useQueryClient

The useQueryClient hook returns the current QueryClient instance.

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

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

const queryClient = useQueryClient(queryClient?: QueryClient)

Options

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