I suggest you do some JS debugging to find out why your first solution does not work. We can’t do that for you. Add a console.log()
command wherever necessary, for example to check if the button was clicked in the first place etc. The basic example you posted should in fact work (if it does not, there’s something wrong), although it is very basic. It would in fact make more sense to use a route to handle the increments.