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:Jump to 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...
4 Replies
Have you read the docs? https://trpc.io/docs/reactjs/introduction
React Query Integration | tRPC
React Query Integration
We have a dedicated integration, which also has the ability to get query keys if you need (but we do it for you)
Yes, i have been reading the docs.
How do i invalidateQueries when i use
useMutation
? i don't know my queryKey name? Thank you.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...