令人眼花S乱的SSR渲染反应,并非根据初始安装说明运行

时间:2019-09-27 13:11:42

标签: reactjs server-side-rendering razzle

运行Razzle的基本安装,我得到错误“ Cannot GET /”,这就是我所做的:

https://github.com/jaredpalmer/razzle

npx create-razzle-app my-app cd我的应用 npm start

1 个答案:

答案 0 :(得分:0)

对于绊脚石的人们:

模板中的client.js需要更改

 import BrowserRouter from 'react-router-dom/BrowserRouter';

 import {BrowserRouter}  from 'react-router-dom';

和在App.js中

import Route from 'react-router-dom/Route';
import Switch from 'react-router-dom/Switch';

import {Route,Switch} from 'react-router-dom';

来源: https://github.com/jaredpalmer/razzle/issues/1022