The page introduces react route
import React, { Component } from 'react';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
// 登录界面
import Login from '../Login/index';
class App extends Component {
render() {
return (
<Router history={browserHistory}>
<Route path="/login" component={Login} />
</Router>
);
}
}
export default App;
But it keeps prompting an error, 'react-router' does not contain an export named 'browserHistory'.
My previous project used history={browserHistory}
How to modify this, are there any missing dependencies?
The react-router version you are using is 4.x, right
The history attribute has been removed from the v4 version of react-router and replaced by the
BrowserRouter
taghttps://github.com/ReactTrain...