Sync the Page Title
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Build a counter: a paragraph reading "Clicks: 0" and a button labelled "Add one" that adds 1. Keep the page's title (document.title) in step with it: "Clicks: 0" as soon as the component mounts, then the new count after every click. When the component unmounts, put back whatever title the page had before it mounted.
Your code must pass
- Sets the title to "Clicks: 0" on mount
- Updates the title on every click
- Puts the old title back when unmounted