tRPCttRPC
Powered by
DevThoughtsD
tRPC•3y 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 })
const query = useQuery({ queryKey: ['todos'], queryFn: getTodos })
Solution
useContext https://trpc.io/docs/reactjs/usecontext
useContext | tRPC
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
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Where can I add a query key?
AliAAli / ❓-help
3y ago
useQuery context
Answer OverflowAAnswer Overflow / ❓-help
3y ago
useQuery caching data
НиткаННитка / ❓-help
2y ago