react-router2的browserHistory问题

#1

使用browserHistory设置路由,刷新页面就无法显示页面了,通过路径访问也是这样,有的资源也加载不到了,有大神知道是怎么回事么?

#2

browserHistory需要配合server使用。你可以有2种解决办法

  1. 换成hashHistory
  2. 配置sever 重定向到index.html
    参考:
    https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#serving-apps-with-client-side-routing
#3

我已经找到了解决方法,谢谢了

1 Like
#4

怎么解决呢?