T
tRPC

❓-help

React Query client and caller client under one object

LLuka11/29/2023
Would love to know if it is possible to have caller and react query clients under one object? I feel like it would be great to go api.cart.getCartItems() in server components that would utilise caller and api.card.getCartItems.useQuery() in client components.
KKrishna12/1/2023
I use the createTRPCProxyClient to create a seperate caller. So I use useQuery where needed & caller where I need the async flow...
LLuka12/1/2023
why use createTRPCProxyClient over just appRouter.createCaller({})
KKrishna12/6/2023
I am not sure I understand. This is my setup. How do create a client without using react-query?
import { createTRPCReact } from "@trpc/react-query";

export const trpc = createTRPCReact<AppRouter>({
abortOnUnmount: true,
});
import { createTRPCReact } from "@trpc/react-query";

export const trpc = createTRPCReact<AppRouter>({
abortOnUnmount: true,
});
Thanks 🙂

Looking for more? Join the community!

T
tRPC

❓-help

Join Server