const context = {}; const markup = ReactDOMServer.renderToString( <StaticRouter location={req.url} context={context}> <App /> </StaticRouter> ); if (context.url) { // Somewhere a `<Redirect>` was rendered redirect(301, context.url); } else { // we're good, send the response }

react ssr true 404

Similar Code Examples