I'm doing server side rendering for my React Js App.when i run my App,I'm getting bellow error.
TypeError: _Router2.default.computeRootMatch is not a function at /home/../web/node_modules/react-router-config/matchRoutes.js:20:24 at Array.some (native) at matchRoutes (/home../web/node_modules/react-router-config/matchRoutes.js:18:10) at /home/../web/build/bundle.js:2250:53 at Layer.handle [as handle_request] (/home/../web/node_modules/express/lib/router/layer.js:95:5) at next (/home/../web/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/home../web/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/home../web/node_modules/express/lib/router/layer.js:95:5) at /home../web/node_modules/express/lib/router/index.js:281:22 at param (/home/../web/node_modules/express/lib/router/index.js:354:14)
server.js file
import express from 'express';
import { matchRoutes } from 'react-router-config';
import Routes from './client/Routes';
import renderer from './helpers/renderer';
import createStore from './helpers/createStore';
const app = express();
app.use(express.static('public'));
app.get('*', (req, res) => {
const store = createStore(req);
const promises = matchRoutes(Routes, req.path)
.map(({ route }) => {
return route.loadData ? route.loadData(store) : null;
})
.map(promise => {
if (promise) {
return new Promise((resolve, reject) => {
promise.then(resolve).catch(resolve);
});
}
});
Promise.all(promises).then(() => {
const context = {};
const content = renderer(req, store, context);
if (context.url) {
return res.redirect(301, context.url);
}
if (context.notFound) {
res.status(404);
}
res.send(content);
});
});
app.listen(3000, () => {
console.log('Listening on prot 3000');
});