Next.js Discord

Discord Forum

How does Next.js receive and hydrate streamed components on the client?

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Cuvier’s Dwarf CaimanOP
We can use async components on the server with Suspense to show a loading UI while the data is being fetched, and this works well with renderToPipeableStream. However, on the client, we need to hydrate the streamed HTML using hydrateRoot. The problem is, we can't import a server component on the client since it's not valid there. So what should we pass as the React element parameter to hydrateRoot in this case?
Next.js use RSC Payload, how to do the same in a vanilla react project?

0 Replies