score:5

Accepted answer

you are mutating state directly but you're also returning a new object via object spreading:

setchecks({ ...checks });

since this creates a new object the component re-renders.

score:0

 mutatemycheck(); mutatemycheck();

that won't increase the checks twice.

in this case you should use a reducer.


Related Query

More Query from same tag