Initially, coming from a class-based React context, I had a hard time understanding hooks.
And the hook I had the hardest time with was useEffect.
Gladly, I understood it, and I now want to show you what useEffect is and how you can use it.
A thread.
0. A quick hook introduction
Hooks were added to React in 16.8 and enable us to write functional components while still using state and other React features like lifecycle methods without a need for classes.
1/15
Some hooks also enable you to set state in functional components.
This doesn't sound like much, but unlike class components, where you had to modify your component's state for React to notice, you need to tell React when something changed in functional components, too.