我已经尝试将此代码转换为react-router-v4。这个想法是,始终会渲染App组件,然后我当前处于活动状态的任何选项卡都将更改(渲染)渲染的App内部的视图。我在转换此代码时遇到了一些麻烦,非常感谢您的帮助。
这以前在React Router v3上起作用。我有一个想法,就是应该将IndexRoute更改为Route,因为我几乎可以肯定它已经折旧为确切的路由路径,但是对于嵌套Routes我却一无所知,这是我最接近的尝试。以前可以正常工作的React-router-v3版本。
<BrowserRouter>
<Route path="/home" component={HomePage} />
<Route path="dashboard" exact component={AsyncDashboard} />
<Route path="input" exact component={AsyncInput} />
<Route path="calendar" exact component={AsyncCalendar} />
<Route path="dropdown" exact component={AsyncDropdowns} />
<Route path="range-picker" exact component={AsyncRangePicker} />
<Route path="chart" exact component={AsyncChart} />
<Route path="layout" exact component={AsyncLayout} />
</BrowserRouter>
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute exact component={AsyncDashboard} />
<Route path="dashboard" exact component={AsyncDashboard} />
<Route path="input" exact component={AsyncInput} />
<Route path="calendar" exact component={AsyncCalendar} />
<Route path="dropdown" exact component={AsyncDropdowns} />
<Route path="range-picker" exact component={AsyncRangePicker} />
<Route path="chart" exact component={AsyncChart} />
<Route path="layout" exact component={AsyncLayout} />
</Route>
</Router>
答案 0 :(得分:0)
"test%20upload.txt"
包裹在App
中,不如直接使用Route
的{{1}}代替Route
/