I'm using the child component inside the parent component. Like below,
class Parent extends Component() {
getContent() {
let arr = [{name: 'abc'},{name: 'bcd'},{name: 'cde'}];
return arr.map(data => <Child name={data.name}/>)
}
render() {
return (
<div>{this.getContent()}</div>
)
}
}
Above code gives warning
Each child in an array should have a unique "key" prop. Check the render method of TableComponent
I don't want the answer like use the unique key as props in child component. Instead please clarify the point why react gives such type of warning what will be the drawback if I don't use the unique key here. Please provide the example of this causes.