React Hooks For Beginners
Hooks let you extract component logic into reusable functions. They’re like the Swiss Army Knife of common class-based React logic for your functional components.
Check out these coding book discounts for Medium readers:
Follow me on Twitter 101K where I post all things JavaScript
Side Note: Always look through official docs first. In this article I cover my own experience with React Hooks. But I know someone on a similar path.
So why this tutorial then? Many hooks tutorials (including official docs) show syntax and how hooks work. But they don’t mention setbacks you’re 100% guaranteed to run into. You know, that moment when you start running into errors even though you are following documentation to a tee!
For example useState({}) hook doesn’t merge state automatically.
(When it’s used with arrays and objects.)
I wrote this React Hooks tutorial when I was still learning them myself. I documented common quirks and pitfalls you’ll run into and how to solve them. Hopefully this will help any new React learners avoid them.
If you want to support my work please check out my JavaScript and CSS books. I’m not Random House…