By using hooks the logic tidies up massively (so working on it becomes a lot quicker) and several hard to diagnose performance bottlenecks disappear.
The 'not classes' stuff is a side benefit.
A HOC previously served as a minimally invasive way to compose these behaviours (compose the HOC + use its param in render).
If you are writing a moderately complex animation, you can quickly end up needing state, willMount, and willUnmount, plus the render change plus the logic, thats five places in a class. If this animation applies to many components you abstract to a HOC and simplify dev overhead at a performance cost.
Using a hook lets you abstract that all into one function as you suggest.
Most of the HOCs I wrote had to do with just local state + store state + logic, so not as extreme (editable, updatable, draggable, deletable etc.); but when you have many, the penalty adds up.
https://medium.com/@dan_abramov/making-sense-of-react-hooks-...
Hope it helps!
[0] https://reactjs.org/docs/hooks-intro.html
[1] https://overreacted.io/why-do-hooks-rely-on-call-order/
[2] https://dev.to/dan_abramov/making-sense-of-react-hooks-2eib
var foo = 1;
var bar = x => x++;
module.exports = function baz() { return bar(foo) }
I find this much more simple then classes. I even consider it an anti-pattern to make a class for something this simple.