I am running my reactjs app and getting a warning in my console:
Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of
AppointmentsContainer
My component looks like this:
export default class AppointmentsContainer extends Component {
constructor(props) {
super(props);
}
render() {
//todo remove
//debugger;
let appointments = mockData.data;
return (
<div>
//loop through the appointments
{appointments.map(function(a,i){
//todo remove
//console.log('testing=a', a);
return <p><Appointment key={i}/></p>
})}
</div>
);
}
}
I am passing in a key now but still the warning comes up? How can I fix this?
i
index for better performance. – hazardous