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
- The title is
Clicks: 0after the page loads - One click makes the title
Clicks: 1 - Two more clicks make it
Clicks: 3 - 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.