Closed gHashTag closed 6 years ago
@gHashTag
Sorry for the delay, missed your message for some reason.
Ust add the StaticRouter
code snippet here.
You will need to change the code here. Last time I checked using renderToNodeStream(reactElement)
didn't work with the StaticRouter context. And logically it coudn't really because by the time you can check context.url
for a redirect most of the page has been streamed to the client.
const context = {};
const markup = renderToString(reactElement);
if (context.url) {
// Somewhere a `<Redirect>` was rendered
redirect(301, context.url);
} else {
re.write(markup);
}
Very interesting solution, but how to add support to it React Router 4 This is docs