路由静态不工作

Route static not working

路线about-us 不工作。仅当我将一些前缀附加到路由 Country 时才有效。我该如何解决它。谢谢

<Route path="/" component={App}>
    <IndexRoute components={Home}/>
    <Route path=":country" components={Country}/>
    <Route path=":country/:city" components={City}/>
    <Route path="*" components={NotMatch}/>
    <Route path="about-us" components={AboutUs}/>
</Route>

交换这两行,

而不是:

<Route path="*" components={NotMatch}/>
<Route path="about-us" components={AboutUs}/>

使用这个:

<Route path="about-us" components={AboutUs}/>
<Route path="*" components={NotMatch}/>

并从路线 countrycountry/:city 中删除 :

像这样:

<Route path="/" component={App}>
    <IndexRoute components={Home}/>
    <Route path="country" components={Country}/>
    <Route path="country/:city" components={City}/>
    <Route path="about-us" components={AboutUs}/>
    <Route path="*" components={NotMatch}/>
</Route>

感谢 Mayank Shukla。你给了我正确的评价。

<Route path="/" component={App}>
    <IndexRoute components={Home}/>
    <Route path="/about-us" components={AboutUs}/>
    <Route path=":country" components={Country}/>
    <Route path=":country/:city" components={City}/>
    <Route path="*" components={NotMatch}/>
</Route>

这个工作。