React - remove item from array

0 votes
86 views
added Jul 17, 2019 in React by LC Marshal Captain (25,770 points)
// Removing item from array by index
const myElement = this.state.list.splice(index, 1);

// Removing item from array by value
const myElement = this.state.list.splice(this.state.list.indexOf(value), 1);

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...