Answer the question
In order to leave comments, you need to log in
How to correctly implement the removal of an element in React?
Hello. Based on the array, I build a table in React. Each row should have a button to delete that row. When clicked, a modal opens for confirmation. I did it this way:
<Table>
<tbody>
{tableData.map(({ id, name }) => (
<tr key={id}>
<td>{name}</td>
<td className="text-right">
<DeleteItem id={id} deleteItem={deleteItem} />
</td>
</tr>
))}
</tbody>
</Table>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question