May 2018
Intermediate to advanced
470 pages
13h 54m
English
In order to load data for the React views when these are rendered on the server, we will use the React Router Config npm module, which provides static route configuration helpers for React Router:
npm install react-router-config --save
We will create a route configuration file that will be used to match routes with incoming request URLs on the server to check whether data must be injected before the server returns the rendered markup.
For the route configuration in MERN Mediastream, we will only list the route that renders the PlayMedia component.
mern-mediastream/client/routeConfig.js:
import PlayMedia from './media/PlayMedia' import { read } from './media/api-media.js' const routes = [ { path: '/media/:mediaId', component: ...Read now
Unlock full access