The component has two ways to add 1 to the count: a synchronous + button, and a Delayed + button that adds 1 after 200ms.
The bug: the delayed callback captures count at the moment it was scheduled. By the time it runs, the real count has moved on — but the callback still computes oldCount + 1 and overwrites everything.
Symptoms
- Start at 0
- Click Delayed + (queues "set to 0 + 1 = 1" for 200ms later)
- Click + immediately (count becomes 1)
- 200ms later: count goes back to 1 instead of becoming 2
Your Task
Make every + truly add 1, no matter what else happened while the timer was pending.
Think about it: setCount(count + 1) reads count from the closure. setCount(prev => prev + 1) reads from the latest state at update time.