T
TanStack3y ago
conscious-sapphire

Having trouble grasping Server Components

Hey! Correct me if I'm wrong here, but in this guide https://tanstack.com/query/latest/docs/react/guides/advanced-ssr you fetch the data in a server component, but then you send it to the client to be hydrated. Wouldn't the benefit of a server component be that in a simple component where you just need the data, it shouldn't need to be hydrated? I realise in those cases I should just use fetch normally I guess, but it's still not clear to me
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...
1 Reply
modern-teal
modern-teal3y ago
yes, sure, only use react-query if you need the client side interactivity: https://tkdodo.eu/blog/you-might-not-need-react-query
You Might Not Need React Query
React Query is a great library, but like any tool, you should choose it for the right problem

Did you find this page helpful?