Javascript react router:如何设置默认子路由并相应修改URL

Javascript react router:如何设置默认子路由并相应修改URL,javascript,reactjs,react-router,Javascript,Reactjs,React Router,我正在使用react路由器v3。我的一段路由代码: ... <Route path='dashboard' component={Dashboard}> <Route path='overview' component={Overview}/> <Route path='scan' component={Scan}/> </Route> ... 。。。 ... 我希望任何访问“/dashboard”的人都被重定向到“/dashboard

我正在使用react路由器v3。我的一段路由代码:

...
<Route path='dashboard' component={Dashboard}>
  <Route path='overview' component={Overview}/>
  <Route path='scan' component={Scan}/>
</Route>
...
。。。
...
我希望任何访问“/dashboard”的人都被重定向到“/dashboard/overview”。我知道我可以使用IndexRoute来实现这一点,但浏览器URL不显示“概述位”。此外,我将使用“链接”路由到“概述”和“扫描”部分。我需要使用它的“activeClassName”功能来应用一些样式。不要认为IndexRoute会触发这种情况

索引重定向:


索引重定向:



如果GilbertNwaiwu解决了你的问题,请考虑接受这个答案。question@GilbertNwaiwu如果解决了你的问题,请考虑接受答案。