News for hackers. Stuff that matters.
Re:React's UseRef Deep Dive by WorldMaker on Thursday December 17, 2020 @06:37PM (#25461946)
> how is useEffect more expressive than componentDidMount

Well, useEffect cross-cuts way more of the component lifecycle than just componentDidMount: it also handles componentDidUpdate and componentWillUnmount, and a few other things that didn't quite get lifecycle functions before. I suppose you could call it useWhenComponentMountsUpdatesOrWillUnmount, but "effect" as in "side effect" for when the component moves through lifecycle events isn't an uncommon name for that sort of thing (even outside of React).

There are no comments on this comment yet.