react-router中hashHistory等history沒法引用

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

解決:react

一、降級npm

npm install react-router@3 --save緩存

二、查閱react-router4的文檔react-router

npm install react-router-dom --savedom

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

當以爲怎麼都不對的時候,終極大法:刪除node_modules,而後npm cache clean -f 強制刪除緩存,從新npm install 便可。對象

相關文章
相關標籤/搜索