Skip to content
Advertisement

Warning Each child in a list should have a unique “key” prop

I have an array of objects which I use to list values in page with map. But from time to time I receive this error.

Warning: Each child in a list should have a unique “key” prop.

Although keys are unique.

Maybe anyone knows what could be wrong here?

JavaScript

Advertisement

Answer

item needs to be a component, and React component names need to be capitalised. Your Item component is expecting an object. Your “key” needs to be placed on the mapped component.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement