使用browserHistory设置路由,刷新页面就无法显示页面了,通过路径访问也是这样,有的资源也加载不到了,有大神知道是怎么回事么?
react-router2的browserHistory问题
browserHistory需要配合server使用。你可以有2种解决办法
- 换成hashHistory
- 配置sever 重定向到index.html
参考:
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#serving-apps-with-client-side-routing