As you know the react 18 alpha version which was just released includes :
Suspense and lazy on the server: You can now use and lazy on the server. Together with the new pipeToNodeWritable method, this solves long-standing pain points and performance problems with server rendering:
Code splitting works together with SSR. You don't have to choose one or the other. React uses your boundaries to stream the page HTML in visual chunks. React uses your boundaries to hydrate the page in chunks, improving responsiveness.
More details there : https://github.com/reactwg/react-18/discussions/47
Dan Abramov has developed a demo https://codesandbox.io/s/festive-star-9hfqt?file=/server/render.js showing how we can set up SSR with react using pipeToNodeWritable, though it is said
we don't have a recommendation yet for how to transfer data from the server to the client to prepopulate the cache
In a typical SSR app in react/react router, you find the route matching the request, and then you await on all the promises that are within your routes's components.
If you you use redux, you can then set the data into the store and render the html. Something like that : https://github.com/ilkeraltin/react-ssr-news/blob/master/src/index.js#L42
My question is how would that fit into Dan Abramov's demo ?
In the render.js file there's a createServerData () function, would that be the location where we basically do, what I described above ? (await on route's promises)