小工具知识网

当前位置: 首页 > 行业知识 > React ant table警告:Each child in a list should have a unique “key“ prop.

行业知识

React ant table警告:Each child in a list should have a unique “key“ prop.

2026-12-02 01:22:34 来源:互联网转载

如下�index.php/tags-41973.html" >�:

原因

React Ant table表格每一行都需要一个唯一标识来确保不重复,如果不加该属性,就会出现这个警告。

修复

添加这一行:

rowKey={(record) => record.id}    # id为行id

Table代码段:

tableData}    columns={this.getSchemeData()}    rowKey={(record) = record.id}    size={'small'}    loading={{        spinning: isLoading, indicator: {            position: 'absolute',            top: '50%',            left: '50%',            margin: '-24px',        }}            "large"}/            }}/>

上一篇:服务器缓存过多怎么清理掉?

下一篇:云服务器怎么建网站