在 使用ant-design的表格时 控制台报错
Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.
Warning: [antd: Table] Each record in dataSource of table should have a unique `key` prop, or set `rowKey` of Table to an unique primary key, see
这是因为表格的每行记录应该有一个key来标识每行的独特性, 如果没有的话 会有很多奇怪的问题
在table 的参数 dataSource 中 如果每条有key这个属性, 则默认使用这个属性 如果没有的话 需要显式地指明key
如:
<Table rowKey="id" dataSource={scripts} columns={columns} />
其中 id 是scripts 这个数组中的每条数据的一个属性
官方截图