April 2020
Intermediate to advanced
716 pages
18h 55m
English
We will use the routes defined in the route configuration file to look for a matching route when the server receives any request. If a match is found, we will use the corresponding loadData method declared for this route in the configuration to retrieve the necessary data, before it is injected into the server-rendered markup representing the React frontend. We will perform these route-matching and data-loading actions in a method called loadBranchData, which is defined as follows:
mern-mediastream/server/express.js
import { matchRoutes } from 'react-router-config' import routes from './../client/routeConfig' const loadBranchData = (location) => { const branch = matchRoutes(routes, location) const promises ...Read now
Unlock full access