Bug Hunt — Auto-Counter Stuck at 1

Debugging — Beginner React challenge.

This counter is supposed to auto-increment by 1 every second while it's running — but it gets stuck at 1 and never climbs any further. This is a debugging challenge: the code already runs, find the stale closure bug and fix it, rather than building the feature from scratch.

Requirements

Signature

function AutoCounter(): JSX.Element

Example

<AutoCounter />
// click "Start Auto", wait 3 seconds
// buggy:   count shows 1 (frozen after the first tick)
// fixed:   count shows 3 (and keeps climbing every second)

Constraints

🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code 🏷️ Get 20% OFF on Yearly & Lifetime plans — use code
Loading workspace…