T
TanStack2y ago
like-gold

All components must be client component when fetch data on server component?

Hello there, I'm newbie of Tanstack query, I tried to fetch data on the server component by the way using prefetch with hyration to client component, but it will make all my child components are client component, although my page have to fetch data too, so each page will be all client component? Please help, I love Tanstack query
5 Replies
fascinating-indigo
fascinating-indigo2y ago
i think you should see the advance server rendering on the docs. i also have this question but reading it cleared it a bit
fascinating-indigo
fascinating-indigo2y ago
Advanced Server Rendering | TanStack Query Docs
Welcome to the Advanced Server Rendering guide, where you will learn all about using React Query with streaming, Server Components and the Next.js app router. You might want to read the Server Rendering & Hydration guide before this one as it teaches the basics for using React Query with SSR, and Performance & Request Waterfalls as well as Pre...
fascinating-indigo
fascinating-indigo2y ago
But where my question lies from the docs is the Data ownership and revalidation section, we can use fetchQuery but not adviced to render the data or pass it as props, can we perform calculations using the data gotten from fetchQuery. and can it be mixed with prefetchQuery and hydrate the data on the client for easy revalidation seems much, just need that clarification
fascinating-indigo
fascinating-indigo2y ago
No description
fascinating-indigo
fascinating-indigo2y ago
@troywoy sorry for tagging you👏 , but can you please clarify this

Did you find this page helpful?