How can I make a direct fetch on a router endpoint from TRPC in NextJS on client?
In the documentation you can use the vanilla TRPC client like this:
But with NextJS app is wrapped with the WithTRPC wrapper. where you can only use hooks. How can I make a direct call?
1 Reply
Read: tRPC Proxy client
https://trpc.io/docs/reactjs/usecontext#proxy-client
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...