Skip to content
0

katanakit-js / useQueryClient

Function: useQueryClient() ​

ts
function useQueryClient(): QueryClient;

Defined in: src/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.

Returns ​

QueryClient

The shared QueryClient.

Example ​

ts
import { useQueryClient } from "katanakit-js";

const client = useQueryClient();
await client.invalidateQueries({ queryKey: ["users"] });

Released under the MIT License.