score:1

Accepted answer

Use index to pick the data you want

In this case you will need to find the last index. this is data.length - 1

Then you can get the very last data by simply going data[data.length - 1]

let datas = (this.state.data && this.state.data.length) && this.state.data[this.state.data.length - 1];

return datas ? (    
<div className="box">  
  <div>
   < Col sm="12" key={datas.id}>
    <div key="a"> 
      <CardText className="textForAdminPageButHereIsForRandomId">{datas.randomID}      
      </CardText>
    </div>
  </Col>
 </div>     
</div>) : null;

Related Query

More Query from same tag