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 开始,路由的配置分散到各组件中

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题