Correct way to fetch data in a server component and pass it to a client component? ReactQuery TRPC
Hi, I want to understand what are the best practices to deal with TRPC and react server components. Say that I want to have a server component that fetches data in the backend using trpc.
I understand that if I am in the server I should use createCaller method from trpc. I tried to do it like so, and pass the data I fetch from the caller to my client component:
1 Reply
Then, in my HomePage client component:
I want to understand, what are the best practices to using server components with TRPc. How should I correctly fetch the data first on the server and then pass it down to react query? Is there a better/More elegant way?