Answer the question
In order to leave comments, you need to log in
How to solve the problem with keys in the map method?
if (data.result !== '') {
setPopout(<ScreenSpinner size='large' />);
data.result.map((e, index) => {
ToDoList.push({id: e.id, name: e.name, key: {index}});
});
setPopout(null);
}
Answer the question
In order to leave comments, you need to log in
You can have many key components on your page. If you always only use the index for this - repetitions are inevitable. To avoid this, make the key a unique string. For example `todo-item-{index}` or you have an id for each element - use it for the key
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question