score:2

Accepted answer
let x = 3
let y = x++
//output: x=4 y=3

let x = 3
let y = ++x
//output: x=4 y=4

it's why you need to double click because you have next logic:

console.log(counter) //0
//triggers click
console.log(counter) //0, usestate re-assigned to 0
//triggers click 
console.log(counter) //1, usestate re-assigned to 1

score:2

difference is that counter + 1 is only an operation and counter++ is an operation with an assignment. in react you shouldn't assign your state directly but use the setter method. so in your case it is better to use counter + 1


Related Query

More Query from same tag