猿问

react-router 引入hashHistory 为何为undefined

import {Router,Link,Route,hashHistory} from 'react-router'

console.log(hashHistory) => undefined  ?

console.log(Route)  => 输出正确


dependencies 中已安装 "react-router": "^4.1.2",  页面运行正常,就是引入react-router 会异常这是为何?

defined

21:09:52.562 main.js:826 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `Root`.

21:09:52.566 main.js:826 Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`.

ght TypeError: Cannot read property 'location' of undefined


chenzhizhuo
浏览 14717回答 8
8回答
随时随地看视频慕课网APP
我要回答