ant-design Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an un

来源:互联网 发布:查看linux开放的端口 编辑:程序博客网 时间:2024/05/22 15:17

个人笔记


使用ant-design 组件 出现此警告的时候

Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.

是因为 返回的数据需要 加上key 

如下


const data=[{ key:'1', name:'John Brown', age:32, address:'New York No. 1 Lake Park',},

{ key:'2', name:'Jim Green', age:42, address:'London No. 1 Lake Park',},

{ key:'3', name:'Joe Black', age:32, address:'Sidney No. 1 Lake Park',}];

browser.js:49Warning: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.
0 0