📄️ Usage with React
How to use and setup tRPC in React
📄️ useQuery()
The hooks provided by @trpc/react-query are a thin wrapper around @tanstack/react-query. For in-depth information about options and usage patterns, refer to their docs on queries.
📄️ useMutation()
The hooks provided by @trpc/react-query are a thin wrapper around @tanstack/react-query. For in-depth information about options and usage patterns, refer to their docs on mutations.
📄️ useInfiniteQuery()
- Your procedure needs to accept a cursor input of any type (string, number, etc)
📄️ useContext()
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 here, we will link to their respective @tanstack/react-query docs so you can refer to them accordingly.
📄️ useQueries()
The useQueries hook can be used to fetch a variable number of queries at the same time using only one hook call.
📄️ getQueryKey()
We provide a getQueryKey helper that accepts a router or procedure so that you can easily provide the native function the correct query key.