如题,完全不知道具体是哪里出了问题.请问如何排查?
Warning: flattenChildren(...): Encountered two children with the same key, .1:$4
. Child keys must be unique; when two children share a key, only the first child will be used.
key重复,key必须是唯一,而且不建议纯数字
你的代码呢?
根据出错提示, 应该是你的代码里在双重循环时,使用了同名的 key.
给循环输出的node添加一个key
属性。
key重复了啊,key必须要保证唯一,这种多个children的key用fragment插件自动生成比较好。