← React Intermediate Questions - Set 1 Q10
How do you handle side effects in functional components?
React Intermediate Questions - Set 1
Example
1
2
3
4
useEffect(() => {
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, []);
What to notice
- Hooks replace componentDidMount/Update/WillUnmount with one place for all three.
← Back to the question list