Conversation
|
Some way to transfer serializable data from server to the client is certainly in scope for the new server rendering infrastructure that supports Suspense. Unclear what the mechanism to do so is though. We probably need to be further along with the rest of the pieces before that becomes clear. |
|
This is why I tried to design this RFC in isolation, and leave as much as possible "unspecified", since I make no assumption on the specifics of how Suspense on the server will work. Essentially this is just the result of me experimenting with how an SSR framework might work with |
This is pretty different from the direction we're going with the Suspense library design, which uses a centralized cache Map to hold data (rather than per-component memory). You can read more about this API here: reactwg/react-18#25. There is still a question of whether we'd want the cache to be "transferable" via a built-in React API, or if you have to use Server Components (#188) and rely on transferring only the rendered output. We don't know how that will work yet. But it seems safe to say that the API shape will likely be different so I think we can close this more confidently. Appreciate the exploration though — it's just that we don't have much to say except that it'll likely be different. |
View rendered
This RFC proposes a
useSerializablehook to automate the extraction, and subsequent hydration of serializable server-side data.