samedi 20 novembre 2021

Date Mapping and Timestamp Convert to date Reactjs

I'm having error it says that "Objects are not valid as a React child. if you meant to render a collection of children, use an array instead" here is my code.

 const timestamp = Object.keys(data).map((id, index) => {
      var startDate = data[id].start_date.seconds
      var start_date = new Date(startDate*1000);
      console.log(start_date)
//Tue Nov 30 2021 03:00:00 GMT+0800 (Standard Time)//
      return [
        index + 1,
        data[id].eventTitle,
        data[id].venue,
        start_date, ///error here
        data[id].end_date.seconds,
]})


<MUIDataTable data={timestamp}/>



Aucun commentaire:

Enregistrer un commentaire