April 2020
Intermediate to advanced
716 pages
18h 55m
English
Once the markup has been generated, we need to check if there was a redirect rendered in the component to be sent in the markup. If there was no redirect, then we get the CSS string from sheets using sheets.toString, and, in the response, we send the Template back with the markup and CSS injected, as shown in the following code.
mern-skeleton/server/express.js:
if (context.url) { return res.redirect(303, context.url)}const css = sheets.toString()res.status(200).send(Template({ markup: markup, css: css}))
An example of a case where redirect is rendered in the component is when we're trying to access a PrivateRoute via a server-side render. As the server-side cannot access the auth token from the browser's ...
Read now
Unlock full access