I want to use use, and use query mutate
I want to use use, fetch or start the on the server component and pass it to a client component and receive it with use but then when I mutate the data, in my mind there would be no key to invalidate but because use is handling the promise on the server?
What would be a good pattern to be able to use mutate and use to start fetching the data right away? Or would doing this totally break the idea?
1 Reply
other-emerald•6mo ago
You can create a promise on the server and pass it to the client with hydration: https://tanstack.com/query/latest/docs/framework/react/guides/advanced-ssr#streaming-with-server-components
Advanced Server Rendering | TanStack Query React 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 before this on...