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

Bug 未结 2 1900
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条回答
  • 2019-05-20 15:54
    使用 edge浏览器也有这个报错,但刷新时不影响左侧菜单显示。
    0 讨论(0)
  • 2019-05-20 16:07

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

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

    举个例子:<Input key="ipt"/>

    0 讨论(4)
提交回复