when user presses a button am just adding the data to an state, and now when user represses it i need to remove the data / and do not let the data to be added to the array ? Am using this on react native !
My state; 
state = { selected = [] };
Now the function to all data to state;
Handler(data){       
     cont {selected } = this.state;
        if(!selected.includes(data))
            {
                this.setState({ selected : [...selected, data] })
                
            }else{
                const index = selected.indexOf(data);
                if (index > -1) {
                    const selection = selected ;
                    selection.splice(index, 1);
                    this.setState({ selected : selection });
                }
            }
    }
But, above keeps on adding the data, as am sending the data as object
Data sent to above function, {available: 'true'}
So, how to do this ? check if the object already presented and remove it ? It works when i pass array like "[true]", but its not working when i pass object !
