May 2018
Intermediate to advanced
470 pages
13h 54m
English
To implement basic server-side rendering, we will need to import the following React, React Router, and Material-UI-specific modules into the server code. In our code structure, these modules will be imported into server/express.js:
import React from 'react'import ReactDOMServer from 'react-dom/server'
Router modules: The StaticRouter is a stateless router that takes the requested URL to match the frontend route and the MainRouter component, which is the root component in our frontend:
import StaticRouter from 'react-router-dom/StaticRouter'import MainRouter from './../client/MainRouter'
Read now
Unlock full access