react Route路由 key的位置问题

react中 设置Route路由 如果使用循环生成路由 应该先写key 再写 to 与 component

1 rootRouterList.map((item, index) => {
2   routerList.push(<Route key={index} path={item.path} component = {item.component} />)
3   return routerList
4 })

 

posted @ 2018-07-14 09:27  MITSU  阅读(1351)  评论(0)    收藏  举报