Skip to content

UseQueryClient

katanakit-js / useQueryClient

function useQueryClient(): QueryClient;

Defined in: core/services/query.service.ts:193

Returns the shared QueryClient singleton, creating one on first call.

This is a process-global instance: it is the right default in the browser, but on the server it would leak cached data across requests. Use useCreateQueryClient per request when running under SSR.

QueryClient

The shared QueryClient.

import { useQueryClient } from "katanakit-js";
const client = useQueryClient();
await client.invalidateQueries({ queryKey: ["users"] });