Log inBook a Demo
DebugMidFrontendAuto-graded

Fix a React counter that increments unpredictably

Auto-increment stops climbing after the first tick, and +1 doesn't reliably add one. Find out why and fix the component without rewriting it.Counter.jsx has a +1 button and an auto-increment toggle, and neither works as it should. Clicking +1 doesn't reliably add one, and auto-increment stops climbing after the first tick. Find out why and fix the existing component. Rewriting it from scratch isn't what's asked for.
20 min
react, javascript

You're done when

  • The counter goes up by exactly one per click and per tick, with no jumps.
  • Auto-increment keeps adding one every second for as long as it's on, including after manual clicks.
  • A single click on +1 adds exactly one.
  • The fix is made in the existing component; it isn't rewritten.

What it measures

React stateHow you reason about what a component's state does as it changes.
DebuggingWhether you trace each symptom to its cause before changing code.
Small, focused fixWhether the change stays small enough for a reviewer to read in a minute.

Your environment

Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards

Start this lab

20 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo