javascript check if int exists in array of objects code example
Example: react array if id is present do not add element
addPerson = (person) => {
let filteredPerson = this.state.likes.filter(like => like.name !== person.name);
this.setState({
likes: [...filteredPerson, person]
})
}