Command Palette

Search for a command to run...

Hectal
Phase 7: Effects
React · Exercise 1 of 5Next
Beginner

Sync the tab title

The counter works on the page, but the browser tab's title never changes. Add an effect so that document.title is always Clicks: N, where N is the current count.

It must say Clicks: 0 right after the page loads, and follow every click on the button (id="add").

What Check tests

  1. The title is Clicks: 0 after the page loads
  2. One click makes the title Clicks: 1
  3. Two more clicks make it Clicks: 3
  4. The title is set inside useEffect

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.