Back to Query

useQueryClient

docs/framework/react/reference/useQueryClient.md

5.90.3343 B
Original Source

The useQueryClient hook returns the current QueryClient instance.

tsx
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.