3 ms·
I think hooks were a mistake. I think components should have been made pure functions, with state/effects being provided by higher order components (HOCs). Fo
by brap 4y ago
I think hooks were a mistake.
I think components should have been made pure functions, with state/effects being provided by higher order components (HOCs).
For example:
Counter = ({count, setCount}) => {
// pure function here
}
StatefulCounter = withState(Counter, {
count: {
setCount: 0
}
})
- notpachet 4y agoYou're basically describing Redux connected components.
- xzel 4y agoAs another child comment said this is how Redux with HoC worked a few years ago. It was very common. Imo working with that paradigm was miserable. You would have a mess of withXXXX type of connections. It was like using decorators or mixins with 0 ergonomics. Hooks are about a million times better.