react 调试 chrome 控制台报这个错时什么原因?

如题,完全不知道具体是哪里出了问题.请问如何排查?
Warning: flattenChildren(...): Encountered two children with the same key, .1:$4. Child keys must be unique; when two children share a key, only the first child will be used.

阅读 11.1k
3 个回答

给循环输出的node添加一个key 属性。

key重复了啊,key必须要保证唯一,这种多个children的key用fragment插件自动生成比较好。

key重复,key必须是唯一,而且不建议纯数字

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