DevThoughtsD
tRPC3y ago
6 replies
DevThoughts

where is useQuery [key]?

Learning trpc, i use to tanstack with queryKey, can not find how that works with trpc, if i want to revalidate my query?
const query = useQuery({ queryKey: ['todos'], queryFn: getTodos })
Solution
useContext is a hook that gives you access to helpers that let you manage the cached data of the queries you execute via @trpc/react-query. These helpers are actually thin wrappers around @tanstack/react-query's queryClient methods. If you want more in-depth information about options and usage patterns for useContext helpers than what we provide...
useContext | tRPC
Was this page helpful?