Re:React I love you, but you're bringing me down
by phailhaus on Tuesday September 20, 2022 @01:42PM
(#32915150)
Imagine trying to debug a component that both has lifecycle methods and reactive hooks? That would be a total nightmare, especially when the same state is being updated in both places (because that would have to be allowed). Going all-in on hooks means that there are two distinct, independent ways of writing components, and you never have to deal with interactions between the two.
I also don't think this would be possible. Hooks are based on closures and injected state, which you can't do in a class since separate methods won't share the closure.
Re:React I love you, but you're bringing me down
by esprehn on Tuesday September 20, 2022 @09:33PM
(#32919960)
Only if you're constrained by the existing API of hooks. Preact signals is a good example of how class components could have been improved with reactivity:
I also don't think this would be possible. Hooks are based on closures and injected state, which you can't do in a class since separate methods won't share the closure.