Updates built from the previous state in React
React interview exercise on State, difficulty 2 of 3. Solve it in the editor beside a worked example; the tests run the moment you do.
Finish Likes: write bump() so that the "+3" button, which calls bump() three times in one handler, adds three. Also an async handler for "Later": it waits 10 ms (setTimeout) and then adds one, which must land correctly even if the user clicked "+1" in the meantime.
Each exercise pairs a worked example with a twin problem to solve in a real editor; the tests run the moment you do. Progress is saved in your browser, and in your account if you sign in.