Antd使用中的需注意的细节
Table-rowKey
index.js:1 Warning: [antd: Table] Each record in dataSource of table should have a unique
key
prop, or setrowKey
of Table to an unique primary key, see https://u.ant.design/table-row-key
我们在使用Table组件时,在浏览器控制台经常会看到这样的warning,原因是行key指定缺失。
假如rowKey不指定,则默认为rowIndex
。所以假如记录确实没有任何唯一的字段,不指定。
1 | getRecordKey = (record: T, index: number) => { |