General pattern is to pass a uniquely identifiable id (key, index, etc...) to your delete handler and filter your data on values that don't equal that key. This returns a new array without that entry to store in state.
deleteItemById = id => {
const filteredData = this.state.data.filter(item => item.id…
Top comments (0)