2017-01-02 29 views
0

我正在使用react-router v3。我的一個路由代碼:react-router:如何設置默認子路由並相應地修改URL

... 
<Route path='dashboard' component={Dashboard}> 
    <Route path='overview' component={Overview}/> 
    <Route path='scan' component={Scan}/> 
</Route> 
... 

我希望任何訪問'/ dashboard'的人都被重定向到'/ dashboard/overview'。我知道我可以使用IndexRoute來實現這一點,但瀏覽器URL不顯示'概述位'。此外,我將使用「鏈接」路由到「概覽」和「掃描」部分。我需要使用其'activeClassName'功能來應用一些樣式。不要以爲IndexRoute會觸發這一點。

回答