I am rendering a table with ant design and it works fine, but there is a warning in the console:
Each record in table should have a unique
keyprop,or setrowKeyto an unique primary key
My code is as follows:
import React, { Component } from 'react';
import {  Table} from 'antd';
import { adalApiFetch } from '../../adalConfig';
class ListTenants extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: []
        };
    }
    fetchData = () => {
        adalApiFetch(fetch, "/Tenant", {})
          .then(response => response.json())
          .then(responseJson => {
            if (!this.isCancelled) {
                const results= responseJson.map(row => ({
                    ClientId: row.ClientId,
                    ClientSecret: row.ClientSecret,
                    Id: row.Id,
                    SiteCollectionTestUrl: row.SiteCollectionTestUrl,
                    TenantDomainUrl: row.TenantDomainUrl
                  }))
              this.setState({ data: results });
            }
          })
          .catch(error => {
            console.error(error);
          });
      };
    componentDidMount(){
        this.fetchData();
    }
    render() {
        const columns = [
                {
                    title: 'Client Id',
                    dataIndex: 'ClientId',
                    key: 'ClientId'
                }, 
                {
                    title: 'Site Collection TestUrl',
                    dataIndex: 'SiteCollectionTestUrl',
                    key: 'SiteCollectionTestUrl',
                },
                {
                    title: 'Tenant DomainUrl',
                    dataIndex: 'TenantDomainUrl',
                    key: 'TenantDomainUrl',
                }
        ];
        return (
            <Table columns={columns} dataSource={this.state.data} />
        );
    }
}
export default ListTenants;
 
     
     
    
 
     
     
     
     
     
     
     
     
    