You're afraid that touching your useEffect's dependency array will result in chaos: stale data being displayed by your components, or worse: infinite re-renders. You even wonder if you should leave the code as it is. Telling your manager that the feature can't be done isn't as bad as dealing with useEffect bugs, is it?
You know that it's possible to write bug-free useEffects, you just don't think YOU can do it.
But what if you could? What if you could write useEffects that "Just Work"? What if you knew exactly how to use the dependency array? You could use useEffect with confidence that it does what you expect it to. Imagine!
It's true, useEffect can be confusing, and easily results in race conditions and infinite re-renders... but it doesn't have to.
Master useEffect in a single afternoon, with useEffect By Example.
You'll learn how to use useEffect to fetch data, and avoid nasty race conditions. Take the guesswork out of using the dependency array, and prevent infinite re-renders with useCallback and useMemo, while also keeping ESLint happy.
Just block out an afternoon, buy a copy of useEffect By Example, and you'll be using useEffect with the confidence that it does exactly what you need in no time.
About the author
Hey, I'm Max Rozen! I'm an ex-Atlassian that has also worked for several startups, and I currently work for Cloudflare.
I've been building React apps both professionally and for side-projects since 2016. I've worked on all sorts of React apps, from small apps with a single page, up to enterprise scale web apps with tens of thousands of users per day.
I've been using Hooks since they came out, and I've been writing tips on how to use them for a while now.
Table of Contents
- Code Examples
- Chapter 1: Understanding useEffect
- Chapter 2: Fetching Data
- Chapter 3: Introducing the dependency array
- Chapter 4: Preventing Race Conditions with useEffect
- Chapter 5: useCallback for useEffect
- Chapter 6: useMemo for useEffect
- Chapter 7: useState and useEffect
- Chapter 8: The ESLint Plugin
- Final Thoughts
What's the refund policy?
If what you see is not what you expected, just reply to the download email within 30 days, and you'll get a full refund. No questions asked.
Can I share this book with my team?
This version is for individual use only, but you can also get a team license to share within your team, class, or organisation.
Praise from others
"This was great! lil pocket rocket of practical information. Really enjoyed reading through this 👏"
— Jack Lo Russo (@lol_russo)
"Yihaaa!!!!!!!! Just resolved an infinite loop bug in my react code using @RozenMD's book useEffect by Example. It's a super short book that provides great detail and coverage of useEffect, useMemo and useCallback."
— Gilbert Mpanga (@Mpanga96)