meow
meow13mo ago

TRPC Vanilla Client (T3 stack)

I'm using the T3 stack (Next + TRPC + etc) and I'm trying to figure out how to do vanilla queries that don't come with the baggage of a hook.
const hello = await api.example.hello.useQuery()
const hello = await api.example.hello.useQuery()
1 Reply
jkob_
jkob_13mo ago
Hey - had the same issue and think I have figured out a solution. The useQuery options were all coming from createTRPCNext<AppRouter>. I think this creates the ability to get the frontend hooks but doesn't create the normal async await versions. If you create an additional object, a createTRPCProxyClient<AppRouter> I think that creates the async/await queries you might be looking for Don't work for trpc so might be wrong though.