问题描述
devScripts.js:6523 Warning: Each child in a list should have a unique "key" prop.
Check the render method of `Body`. See https://reactjs.org/link/warning-keys for more information.
at BodyRow (http://**:8000/umi.js:392823:25)
in Body (created by Table)
in table (created by Table)
in div (created by Table)
in div (created by Table)
问题截图
问题分析
Check the render method of 'Body'.
,Table
组件没有加 rowKey
导致
问题解决
// 为 rowKey 属性赋值
<Table dataSource={data} rowKey={(record) => record.id}>
// ...
</Table>
问题消失 nice~
附:如果id不能保证唯一,可以使用index, 或者随机数 // 注意更新时不可用
# index 使用方式
index.toString()
#