alepha@docs:~/docs/reference/react-hooks$
cat useQueryClient.md | pretty1 min read
Last commit:
#useQueryClient
#Import
typescript
1import { useQueryClient } from "alepha/react";
#Overview
Imperative access to the query cache used by useQuery.
Most invalidation should be declarative — useAction({ invalidates }) —
because it keeps the write and the keys it affects in one place. Reach for
this hook when the trigger is not a useAction: a websocket message, a
router event, or an optimistic write applied before the request settles.
tsx
1const queries = useQueryClient();2 3useEvents("folio:updated", ({ campaignId }) => {4 queries.invalidate(["folios", campaignId]);5});