2016-02-14 145 views
1

这里休息:https://github.com/reactjs/react-router/issues/3077无法强制刷新浏览器,浏览事后

我以前设置我的历史如下:

import createHistory from 'history/lib/createHashHistory'; 
const history = createHistory(); 
const middleware = syncHistory(history); 

有了,我得到现在一个警告:

Warning: [react-router] It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by React Router with `import { browserHistory } from 'react-router'` or `import { hashHistory } from 'react-router'`. If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details. 

如果然而,我做任何事情来解决这个警告应用程序的初始负载(不使用哈希在URL中)将加载,我可以导航。但是,如果我坚持刷新页面,整个事情就会死亡,只会导航到家庭网址,没有更多。我必须通过删除散列并生成新密钥来实现应用程序。

我已经尝试了以下变化:

import hashHistory from 'react-router/lib/hashHistory'; 
const history = hashHistory; 
const middleware = syncHistory(hashHistory); 

和:

import createHashHistory from 'history/lib/createHashHistory'; 
const history = useRouterHistory(createHashHistory)(); 
const middleware = syncHistory(history); 

有一些改变,我可能会在升级指南错过了什么?

这是我的主要JSX文件:

https://github.com/awsbb/awsbb/blob/master/webpack/application.jsx#L19

我的package.json有 “*” 的所有版本。

任何人都可以提供一些见解我缺少的东西或任何进一步的信息,你需要吗?

谢谢!

回答

0

我:

在我的头,但没有放在HREF =“/”或在那里另一个链接。

删除此节点或向其添加href =“/”可修复硬刷新问题。检查历史库中的“useBasename”中是否存在实际的错误。