Server Side Rendering & TRPC Router / Client Code
Hey guys I'm using t3 stack and trying to load data server side with hydration/dehydration - not sure I've done this right though. I've added another react-query (v5) provider with the hydration boundary in the page... Then realised there's already the TRPC context & provider, so I updated trpc server/client/next/react-query to:
"@trpc/client": "next",
"@trpc/next": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
But it's all going wrong now 😄
Anyone have any experience with this?
1 Reply
Came back to this and realised the error of my ways, must have been half asleep at the time 😄 So I'm using the trpc server api in page.tsx to preload the data required for initial render and passing this to a prop of a subcomponent, and in the Component using the trpc client api useQuery with initialData set to the prop value