I believe that you are indeed exagerating. Hooks are wonderful, but you are trying too hard too make them look good.
My point is that yes, you are right in some way that react hooks are more declarative than class components, but only because react decided to cripple the hooks by not supporting class components
Weirdly, the React ecosystem decided that the proper reaction to that issue was to bash on class components for not being compatible with hooks instead of lamenting about the lack of class support for hooks.
But it is certainly possible to have hooks in class components (if the framework decides to implement it). And with those hooks, your two arguments against class would be nullified:
the user state would be captured by the hook closure, so the component would not need to manage the saving operation
the hook would register itself on the mounted/prop update lifecycle of the component, but with just one function without duplication, and properly isolated from the component.
by the way, sorry to react again to your posts. I just kind of enjoy the discussion about interesting points... Hope you don't take it as an attack or anything.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I believe that you are indeed exagerating. Hooks are wonderful, but you are trying too hard too make them look good.
My point is that yes, you are right in some way that react hooks are more declarative than class components, but only because react decided to cripple the hooks by not supporting class components
Weirdly, the React ecosystem decided that the proper reaction to that issue was to bash on class components for not being compatible with hooks instead of lamenting about the lack of class support for hooks.
But it is certainly possible to have hooks in class components (if the framework decides to implement it). And with those hooks, your two arguments against class would be nullified:
by the way, sorry to react again to your posts. I just kind of enjoy the discussion about interesting points... Hope you don't take it as an attack or anything.