UseCreateQueryClient
katanakit-js / useCreateQueryClient
Function: useCreateQueryClient()
Section titled “Function: useCreateQueryClient()”function useCreateQueryClient(config?): QueryClient;Defined in: core/services/query.service.ts:172
Creates a new QueryClient. Use this on the server (SSR) to get one client per request and avoid sharing a process-global cache across users.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
config? |
QueryClientConfig |
TanStack QueryClientConfig (caches, default options). |
Returns
Section titled “Returns”QueryClient
A fresh QueryClient.
Example
Section titled “Example”// Server: one client per request, then dehydrate/hydrate.const client = useCreateQueryClient();await client.prefetchQuery({ queryKey, queryFn });const state = dehydrate(client);