react-router,4.0版本 控制台warning

Warning: You should not use <Route component> and <Route children> in the same route; <Route component> will be ignored warning @ tiny-warning.esm.js:12

但是不影响正常使用

<Switch>
    <Redirect path="/" exact={true} to="/index" />
    <Route component={Index} path='/'>
        <Route path='/index' component={Indexpage}/>
        <Route path='/artical' component={ArticalList}/>
    </Route>
</Switch>

求大佬讲解一下呀

阅读 4.2k
1 个回答

Route组件不能嵌套使用,react-router 4.0 开始,路由的配置分散到各组件中

推荐问题