Training Grounds
Timer That StacksBlue Belt
+25 Ki
Description

A stopwatch counts up every second. Each time you click Reset the counter resets but the speed doubles — after three resets it ticks four times per second.

Anomaly

Click Reset once — the counter ticks normally but jumps by 2 every second. Click again — jumps by 3. The interval stacks with each reset.

Constraint
Fix must use the cleanup return from useEffect
Do not change the interval duration or the tick logic
Hint

Every time the effect runs, it creates a new interval. Without a cleanup function returning clearInterval, the old intervals are never cancelled.

Consult the SenseiOnly for those truly stuck · Flip to reveal

Every time the effect runs, it creates a new interval. Without a cleanup function returning clearInterval, the old intervals are never cancelled.

Loading editor…
Correct Solution
Loading...
Expected OutputGoal State
Your OutputLive