I have pretty clear object and map function in react js.
My data is in state variable this.state.response
response = [
{
"number": "CA1",
"name": "Kiran",
"type": "Books",
"contact": "98989898"
},
{
"number": "CA2",
"name": "Rahul",
"type": "MP3",
"contact": "98989898"
}
]
& Here I want to print data in table in react jsx file
{
this.state.response !== "" &&
this.state.response.map((data, i) => (
<tr key={i}>
<td>{i+1}</td>
{
console.log("Here I want to print data");
}
<td></td>
</tr>
))
}
I can access each data with {data.number} or {data.name}
But I dont know the keys like number, name or type in the response which is dynamic data from API.
So my question is how can I create multiple with data value from response.