Aug 28, 2022
I think the heart of your issue is that React hooks aren't really Functional Programming, they're a weird hybrid between FP and OOP. But because we're living in the land of closures, where every render is like a completely different universe, until you use an effect to preserve state across renders, it's easy to become confused. And of course, the React devtools aren't helpful when your state variables are all called state1, state2, state3, etc.