Answer the question
In order to leave comments, you need to log in
Am I correct in removing an element from a list in React?
Hello! I'm learning React. Read Main Concepts in the documentation. Decided to make a simple tudu sheet. I implemented the removal of a list element like this (by googling):
this.setState(prevState =>({
todoItems: prevState.todoItems.filter(itemKey => itemKey != deletedItemsKey)
}));
Answer the question
In order to leave comments, you need to log in
In React, you render a list based on data:
<List>
{data.map(item => <Item key={item.id} item={item} />)}
</List>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question