猿问

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的值修改下就可以了    


倚天杖
浏览 2458回答 3
3回答

一只斗牛犬

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

哔哔one

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

牛魔王的故事

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

相关分类

JavaScript
我要回答