Warning: Each child in a list should have a unique "key" prop.
You will get this warning only when two or more items in the list have been supplied with the same key, Your code looks fine for me, it shouldn't be giving this warning
, please try with a console.log(index) inside the map
.
const faqdata = this.props.faqData.map((faq, index) => {
console.log(index);
<li key={index}>
{faq.description}
</li>
});
Anti Pattern:
You should not be using index of the map for you Key, its an antipattern,
it may lead to unpredictable results.
Please check this https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318
You should be using proper unique-id for your Key, like a DB id or some unique-id.
This Key is used internally to identify the DOM elements to render and not to render again.