react-router中hashHistory等history無法引用


react-router4中不支持直接從react-router中引用hashHistory等history對象。

解決:

1、降級

npm install react-router@3 --save

2、查閱react-router4的文檔

npm install react-router-dom --save

import { hashHistory } from "react-router-dom"

當覺得怎么都不對的時候,終極大法:刪除node_modules,然后npm cache clean -f 強制刪除緩存,重新npm install 即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM