javascript - Error reporting when using reaaft route
三叔
三叔 2017-06-26 10:54:49
0
1
817

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?

三叔
三叔

reply all(1)
女神的闺蜜爱上我

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 tag
https://github.com/ReactTrain...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template