T
tRPC

ā“-help

UseQuery with no Input but query options

Aabd_ulbasit8/6/2023
I have a trpc protected procedure that does not take any input. First argument of use query is input .If i dont provide input it gets mad says type bla bla is not assignable to type void. I came across a workaround for using undefined in place of empty input . is there any better approach ?
const { data} = trpc.cart.getUserCart.useQuery(undefined, { enabled: !!UserSession?.user?.id });
const { data} = trpc.cart.getUserCart.useQuery(undefined, { enabled: !!UserSession?.user?.id });
AKAlex / KATT 🐱8/6/2023
You're doing it right

Looking for more? Join the community!

T
tRPC

ā“-help

Join Server