I’m getting really tired of these distictions people make, saying either class components or hooks are better.
Class components were fine. Hooks are also fine.
They both give you plenty of rope to hang yourself with. And if a component in either form is hard to understand it’s probably just too f big.
What bother me most is those people that have no clue how hooks work, but claim their “functional” components are now faster, because they’ve read that functional is good somewhere.
The benefit hooks bring is that as well as already being able to separate out components, you can now separate out React functionality into reusable pieces in a clean way.
It's not about making something possible; it hasn't introduced any new capabilities. It's about improved semantics.
Everything that is possible with programming has been possible since we were poking hex codes directly into memory. All language improvements have been about semantics, or fixing performance degradations brought about by new programming paradigms.
[edit] I do agree that mixins could've been good too.
For me (and I suspect a few other people working with react, but certainly not everyone), the main issue with hooks is exactly that class components were fine, and hooks are fine, and we did not need nor want more "fine".
Hooks feel more like something added to fill in space and another example of the ecosystem bloating itself just for show.
Class components were fine. Hooks are also fine.
They both give you plenty of rope to hang yourself with. And if a component in either form is hard to understand it’s probably just too f big.
What bother me most is those people that have no clue how hooks work, but claim their “functional” components are now faster, because they’ve read that functional is good somewhere.