Answers for "how to delete element at a particular index of array in react js"

1

how to delete element at a particular index of array in react js

var array = [...this.state.people]; // make a separate copy of the array
  var index = array.indexOf(e.target.value)
  if (index !== -1) {
    array.splice(index, 1);
    this.setState({people: array});
  }
Posted by: Guest on February-19-2021

Code answers related to "how to delete element at a particular index of array in react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language