Updating MainRouter

Once the code rendered on the server side reaches the browser, and the frontend script takes over, we need to remove the server-side injected CSS when the main component mounts. This will give back full control over rendering the React app to the client side:

mern-skeleton/client/MainRouter.js:

componentDidMount() {   const jssStyles = document.getElementById('jss-server-side')   if (jssStyles && jssStyles.parentNode)      jssStyles.parentNode.removeChild(jssStyles)}

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.