TRPC vanilla queries (T3 stack)

Does anyone know how to access trpc vanilla queries (not hooks)?
async function handler() {
const response = await api.example.hello.useQuery() // more like a fetch then a react hook.
console.log(response)
}
async function handler() {
const response = await api.example.hello.useQuery() // more like a fetch then a react hook.
console.log(response)
}
2 Replies
cje
cje2y ago
you needt o make a vanilla client https://trpc.io/docs/v9/vanilla
Vanilla client | tRPC
The magic of tRPC is making strongly typed API calls without relying on code generation. With full-stack TypeScript projects, you can directly import types from the server into the client! This is a vital part of how tRPC works.
pagwin
pagwin2y ago
I've actually done this myself due to not understanding react query so here's a link to my code to yoink https://discord.com/channels/966627436387266600/1126684886745485333/1126753035150962738
Want results from more Discord servers?
Add your server