I'm trying to use Array.pop(Array.indexOf(value)) but it delete the last element in the index even if the value of that index is not same as I set it, can you please help me
CheckBoxHandler1(e) {
console.log(e.target.checked, e.target.name);
let temp = [...this.state.boxes];
e.target.checked === true
? temp.push(e.target.name)
: temp.pop(temp.indexOf(e.target.name));
this.setState({
boxes: temp,
});
}