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 即可。