Demo mode — data resets on refresh.
Hooks Deep Dive
useEffect
Side Effects in React
A side effect is anything that reaches outside the component: fetching data, setting up subscriptions, or directly manipulating the DOM.
The useEffect Hook
useEffect runs after every render by default. You can control when it runs using the dependency array.
useEffect(() => { document.title = count }, [count])
This runs whenever count changes. The dependency array is the second argument.
Cleanup
useEffect can return a cleanup function. This runs before the next effect and when the component unmounts. Use this for subscriptions, timers, and event listeners.