REACT
Free Section Starter Challenge
30 min
3. Managing Side Effects with useEffect()
Overview: Synchronize external APIs, update document.title, and handle timers.
Concept & Syntax Guide
`useEffect(fn, deps)` runs after render. Specifying an empty dependency array `[]` ensures the effect runs only once when the component mounts.
Hands-On Practice Exercise
Update Document Title on Mount
Use `useEffect` to set `document.title = "Stro Hafta Catalog"` when the component mounts.
Target Output:
Stro Hafta Catalog
Need a hint? Click here to reveal
Hint: Check syntax carefully and make sure your code contains:
Stro Hafta Catalog
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10