I am getting this Warning: Each child in a list should have a unique "key" prop.' in my react aplication. I read this doc https://reactjs.org/docs/lists-and-keys.html#keys
And I am ready doing this in my code.
<div className="App">
{data.map((category) => {
return (
<>
<Label key={category.key}>{category.key}</Label>
</>
);
}
)}
</div>
And my data is
const data: any[] = [
{
key: "Main 1",
items: [
{ key: "subitem1", checked: true },
]
},
{
key: "Main 2",
items: [
{ key: "subitem2, checked: true },
]
}
]
I have installed the React plugin in my browser. But I don't see how can I find out which element is missing the 'key' prop?