sword版本在chrome浏览器报错:same key, `desc-2`

Bug 未结 2 2135
hnmas
hnmas 2019-05-20 15:41

使用 chrome 浏览器时,首次访问正常,但console报错:Encountered two children with the same key, `desc-2`. 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,这时如果重新刷新页,左侧菜单就不能显示了,如何处理?

2条回答
  •  admin
    admin (楼主)
    2019-05-20 16:07

    react组件限制,找到对应的组件给他一个不重复的key属性就能解决。

    但这个一般可以无视,不会有影响

    举个例子:

提交回复