The prop `history` is marked as required in `Router`, but its value is `undefined`. in Router

前端 未结 7 864
甜味超标
甜味超标 2021-01-30 01:50

I am new to ReactJs. This is my code:

var React = require(\'react\');
var ReactDOM = require(\'react-dom\');
var {Route, Router, IndexRoute, hashHistory} = requ         


        
相关标签:
7条回答
  • 2021-01-30 02:51

    Version 4 of React Router changed several things. They made separate top level router elements for the different history types. If you're using version 4 you should be able to replace <Router history={hashHistory}> with <HashRouter> or <BrowserRouter>.
    For more detail, see https://reacttraining.com/react-router/web/guides

    0 讨论(0)
提交回复
热议问题