|
|
|
|
|
by pixelkritzel
2009 days ago
|
|
Yup, I use React professionally for four years now with some really big applications (10ks LOC) and I would always opt for class components. The hooks API not only suffer from weird wording (how is useEffect more expressive than componentDidMount) but it introduced some concepts like dependency declarations (again useEffect) and a new meta syntax. It could have been a good development if the published preview would have been a real request for comments with the possibility of changing something. But instead it was introduced as stable in basically the same form. |
|
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).