zilahir
zilahir
TTCTheo's Typesafe Cult
Created by zilahir on 10/29/2023 in #questions
ct3a with `react-query`
Hi! I am messing around with ct3a, and honeslty it's pretty good. Trpc is great, react-query is great, but even though I've read the docs, I am not sure how to call trpc procudere with react-query. I've been trying whats in the docs also:
const thisUser = await api.user.getUser.useQuery()
const thisUser = await api.user.getUser.useQuery()
but seems like the useQuery is not exists on the type:
Property 'useQuery' does not exist on type '{ query: Resolver<BuildProcedure....
Property 'useQuery' does not exist on type '{ query: Resolver<BuildProcedure....
the API looks like this:
export const userRouter = createTRPCRouter({
getUser: protectedProcedure.query(({ ctx }) => ({
...ctx.session.user
}))
})
export const userRouter = createTRPCRouter({
getUser: protectedProcedure.query(({ ctx }) => ({
...ctx.session.user
}))
})
I am pretty sure I am missing something, but i am not sure what. Any help would be appricaited! 🙂 Thakn you!
19 replies