Like button count

Hi Everyone!

I’m looking for a code for like count when user press on also when user already pressed it will be substract counting.

Thanks for your help

What code do you have so far? What are you expecting it to do, and what is actually happening?

on button click just sent true or false value method and show count var.

onLike(click){
this.click = !click;

if(this.click){
this.count++;
}else{
this.count–;
}
}
this will work if you able to sent value and bind ‘this.click’ value with button so that you can monitor the status of button