react异常 Each child in a list should have a unique “key” prop

react异常 Each child in a list should have a unique “key” prop

react异常警告:Each child in a list should have a unique “key” propreact异常 Each child in a list should have a unique “key” prop
原因:Dom在渲染数组时,需要一个key,不然嵌套数组时会引起歧义

解决:

{
  title:"customField",
  dataIndex:"customField",
  key:"customField",
  render:(text,record) => {
    return record.userCustomField.map(item,index) =>{
     return(
        <div key={index}>
           <Text delete={!record.enable}>{item.customFieldName}</Text>
        </div>
     )
  }
}
上一篇:英语六级作文万能模板精华版


下一篇:c语言 8-7