react报错求解!

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的值修改下就可以了    
阅读 8.7k
4 个回答

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

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

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

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