ckinmind / ReactCollect

📦收集整理所有在使用React/Mobx中遇到的问题, 请看issues
93 stars 15 forks source link

关于react-router报错 Hash history cannot PUSH the same path #125

Open ckinmind opened 7 years ago

ckinmind commented 7 years ago

发现使用新版本的路由的时候,点击同一个路由会有如下警告

Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack

参考资料:Warning: You cannot PUSH the same path using hash history

JustinYi922 commented 7 years ago

I have the same problem, too。Have you solved it?

ckinmind commented 7 years ago

@JustinYi922 这个问题应该只在开发环境有,构建打包后应该就不会有这个警告了,我的参考资料中有解释:

The warning is there just to let you know that when you're using hash history, you can't actually PUSH the same path; the browser won't add anything to the history stack. But you should only get this warning in development. If you generate your production build correctly (using NODE_ENV=production) you shouldn't see this warning in production.

JustinYi922 commented 7 years ago

不好意思是我搞错了。我把pathName敲成path了。