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 便可。对象

相关文章
相关标签/搜索