I'm began to use Suspense to my react app and then I turned it to SSR, but while reading the docs: https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream
I do not see anywhere how to use a custom HTML, before we used to replace the div#root to the renderToString() and you could add the title of the document and meta tags, now, with that function I only see how to return the html string from <App />
with the renderToPipeableStream
function:
const stream = renderToPipeableStream(
<StaticRouter location={req.url}>
<App
data={json}
pathLang={checkLanguage(lang) ? lang : ''}
statusCode={status}
cookiesAccepted={accepted}
/>
</StaticRouter>,
{
onShellReady() {
res.setHeader('Content-type', 'text/html');
stream.pipe(res);
},
}
);
Is there any way to intercept the constructed html in order to place it into my index.html
?