Create ServerDataContext and
resolveData helper.
Wrap your application in
ServerDataContext. Next, render
application for the first time.
Wait for all effects to resolve.
Inject resolved data into HTML.
Render your application for the second time.
const { ServerDataContext, resolveData } = createServerContext();
renderToString(
<ServerDataContext>
<App />
</ServerDataContext>
);
const data = await resolveData();
res.write(data.toHtml());
const htmlStream = renderToNodeStream(
<ServerDataContext>
<App />
</ServerDataContext>
);