为了账号安全,请及时绑定邮箱和手机立即绑定

react报错求解!

react报错求解!

倚天杖 2019-03-19 17:18:25
Warning: Encountered two children with the same key, `.$4`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.    in ul (created by DOMWrap)    in DOMWrap (created by Menu)    in Provider (created by Menu)    in Menu (created by Menu)    in Menu (created by Left)    in div (created by Sider)    in div (created by Sider)    in Sider (created by Left)    in Left (created by Main)    in div (created by BasicLayout)    in BasicLayout (created by Adapter)    in Adapter (created by Main)    in Main (created by Connect(Main))    in Connect(Main) (created by Route)    in Route    in Switch    in Router    in Provider    in Unknown            以上为react错误代码,求解!               问题以解决  把Key的值修改下就可以了    
查看完整描述

3 回答

?
一只斗牛犬

TA贡献1784条经验 获得超2个赞

这是warning不是error,原因来自于你遍历渲染了一个数组的元素,然后有元素的key是相同的。


查看完整回答
反对 回复 2019-03-26
?
哔哔one

TA贡献1854条经验 获得超8个赞

你用了同一个key:‘.$4’,key是标识,不能重复


查看完整回答
反对 回复 2019-03-26
?
牛魔王的故事

TA贡献1830条经验 获得超3个赞

看到类似很多的问题,为什么不读这些信息呢?是英文看不懂,还是什么原因呢。
我英语体育老师教的,也能猜个大概。

查看完整回答
反对 回复 2019-03-26
  • 3 回答
  • 0 关注
  • 2457 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信