top | item 36794871

(no title)

zebracanevra | 2 years ago

The React code in the article has a bug. If you click "Increment later", then immediately click "Decrement", the counter will go from 0, to -1, then erroneously to 1. To fix this, the code for the "Increment later" button should be `setTimeout(() => setCount(count => count + 1), 1000)`.

I don't believe any of the other frameworks have this specific problem.

discuss

order

No comments yet.