API Reference

useQueryClient

The useQueryClient hook returns the current QueryClient instance.

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

const queryClient = useQueryClient(id?: string)

Options

  • id?: string

    • Use this if you have set up multiple VueQueryPlugin instances with different queryClientKeys, to select which injected QueryClient to use. Otherwise, the one from the nearest context will be used.

      Returns

  • QueryClient

    • The injected QueryClient instance. Throws if none is found in context.