I am learning React and came across a slightly tricky problem for my level. From my API call I get a response which is an array of objects. I want to display this in a list. To get the idea of how the response looks, this is an example (it is array of JSON)
data = [
{0: {name: "tom"}},
{1: {name: "Pope"}},
{2: {name: "jack"}}
];
To render this information in my container I try something like this:
render() {
const items = data.map((d) => <li>{d.name}</li>);
return (
<div>
<ul>
{items}
</ul>
</div>
)
}
But it's not printing anything. I don't even get any error. I think the way I am parsing the response is wrong.
What is the correct way to solve my tricky problem?