无法将React-Router版本3代码转换为版本5

时间:2019-03-25 19:33:39

标签: javascript reactjs react-router react-router-v5

我正在做React项目。我使用了react-router 3.2.0,它可以正常工作,但是我想使用最新版本的react-router 5进行转换。我是ReactJS的初学者,并且尝试了很多逻辑,但无法将其转换为react-router 5版。有人可以帮我解决这个问题。

代码

import {Router, Route, IndexRoute, browserHistory} from 'react-router'

 <Router history={browserHistory}>
                <Route path="/" component={App}>
                    <IndexRoute exact component={Dashboard} />
                    <Route path="dashboard" exact component={Dashboard} />
                    <Route
                        path="organization"
                        exact
                        component={Organization}
                    />
                    <Route path="products" exact component={Products} />
                    <Route path="sales" exact component={SalesOrder} />
                    <Route path="purchase" exact component={Purchase} />
                    <Route path="shipments" exact component={Shipments} />
                    <Route path="everything" exact component={Everything} />
                    <Route path="reports" exact component={Report} />
                    <Route path="logout" exact component={Logout} />
                </Route>
                <Route exact path="/organization/new" component={OrgnizationForm}/>
            </Router>

0 个答案:

没有答案