antd 报错Warning: Each child in a list should have a unique "key" prop.

304 阅读1分钟

使用antd v5.5 的table组件,dataSource 是服务端给的数据,columns是固定的

  <Table bordered dataSource={dataSource} columns={columns)} />

渲染后报错 Warning: Each child in a list should have a unique "key" prop.

image.png

解决方案

 <Table bordered dataSource={dataSource} columns={columns} rowKey={item => item.id} />

antd组件还有其他的错误汇总

blog.csdn.net/AS_TS/artic…