π₯ BOOM π₯
Infinite loop! βΎοΈ
Stale data! π
Unexplainable bugs. π
And if someone asked you to explain what went wrong, honestly... you'd be hard pressed
to say why it broke.
So you mostly cross your fingers and obey the warnings.
React Hook useEffect has a missing dependency: 'todos'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
It's just that every now and then the warning is wrong β and when you obey, you get an infinite loop.
Even when things are working, there's something that feels wrong about writing code you can't explain.
A sense of unease.
...never quite sure if the code will keep working, or if it's merely fine for now.
You surely could figure out useEffect on your own, given enough time with docs and blog posts. But there's just never enough time to really dive in. Features to ship. Deadlines to meet.
But what if you could learn it quick?
I've put together a set of 8 short screencasts and code examples to help you understand useEffect and put it into practice.
I'll help you understand the bigger picture: not just how useEffect works and when it runs, but how to use it to solve common UI problems, with practical examples from real apps I've worked on.
These quick lessons will make useEffect seem easy. You'll wonder why you got stuck π
In under an hour, you'll be able to know exactly what your code will do before you run it.
And if you've been clinging to lifecycles and classes for dear life, understanding useEffect
will help you join the world of hooks and modern React development.
Here's what you'll learn:
exhaustive-deps
warning againuseLocalStorage
custom hook to read and write from local storageHi! π I'm Dave Ceddia.
I've been working with and teaching React since 2015 at daveceddia.com, mainly through writing and courses like this one. In 2018 I quit my job to teach full-time.
I split my free time between a constantly-shifting array of hobbies like music, cooking, DIY projects, video games, and whatever happens to seem fun in the moment.