我无法修复此错误...我启动服务器,一切正常,因为我刷新localhost:3000然后它显示一个错误:
TypeError:(0,_reactRouter.match)不是函数
我安装了"react-router":"^ 4.0.0"
import Express from 'express';
import {RouterContext, match} from 'react-router';
import {renderToString } from 'react-dom/server';
import React from 'react';
import routes from './routes.js'
var app = new Express();
app.set('view engine', 'ejs');
app.set('views',__dirname);
//////////////////////////////////////////////////////////////////////
app.get('*', (req, res) => {
match(
{ routes, location: req.url },
(err, redirectLocation, renderProps) => {
if (err) {
return res.status(500).send(err.message);
}
if (redirectLocation) {
return res.redirect(302, redirectLocation.pathname + redirectLocation.search);
}
var markup;
if (renderProps) {
// if the current route matched we have …Run Code Online (Sandbox Code Playgroud)