Command Palette

Search for a command to run...

Hectal
Phase 4: State and Events
React · Exercise 2 of 5 PreviousNext
Beginner

Fix the +3 button

The +3 button (id="add3") is supposed to add 3 points by calling the setter three times, but each click adds only 1. The score is shown in id="score".

Fix it without changing it to a single setScore(score + 3): keep the three setter calls and make each one build on the previous one.

What Check tests

  1. The score starts at 0
  2. One click shows 3
  3. A second click shows 6
  4. It still calls the setter three times, with updater functions

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.