The useEffect hook is the Swiss Army knife of all the hooks. It’s the solution to many problems: how to fetch data when a component mounts, how to run code when state changes or when a prop changes, how to set up timers or intervals, you name it. Pretty much anything you want to “do” in a React component other than return JSX (any sort of side effect), will go into a useEffect. (and you can have m
![How the useEffect Hook Works (with Examples)](https://cdn-ak-scissors.b.st-hatena.com/image/square/ba32ac18ecd1382dcc0145ded6189ab173a7a241/height=288;version=1;width=512/https%3A%2F%2Fdaveceddia.com%2Fimages%2FuseEffect-hook-twitter.png)