4 ms·
It's a bit frustrating how difficult it is to find out the old value of a dependency of a React useEffect hook: https://stackoverflow.com/questions/73399384/how
by snowstormsun 4y ago
It's a bit frustrating how difficult it is to find out the old value of a dependency of a React useEffect hook: https://stackoverflow.com/questions/73399384/how-to-get-and-compare-previous-state-value-with-a-new-value-inside-useeffect https://stackoverflow.com/questions/73399384/how-to-get-and-...
Back with components, it was trivial to compare old and new values and change the state based on that.
- Sammi 4y agoI was super interested in hooks when they first came out. But after a short honeymoon period I noticed all the complex rules, exceptions, caveats, and footguns, and I wondered how the React team ever thought this was something you could put into the hands on new developers and expect them to not run into trouble. It reminds me of teachers who have been teaching so long that they don't understand what it's like to be new to the subject any more. It's called The Curse of Knowledge cognitive bias: https://en.wikipedia.org/wiki/Curse_of_knowledge https://en.wikipedia.org/wiki/Curse_of_knowledge