DEV Community

Discussion on: Intro to React Hooks

Collapse
 
barzi92367868 profile image
Barzi

I agree with you on the fact that hooks make life simpler in some conditions. But class components aren't necessarily longer. You don't even need a constructor to declare a state, just use state={counter: 0} and the same can be said for lifecycle components. You could log the value of counter in the render() method without doing it twice in two different methods (didupdate and didmount). I agree with you on the general line, but I think that you tried too hard to put class components in a bad light

Collapse
 
jasonetaylor profile image
Jason

I wouldn't say he tried too hard to put classes in a bad light. His examples are very much the same as anyone else showing what hooks can do. There was a reason the react team released hooks.

Collapse
 
barzi92367868 profile image
Barzi

There are several reasons why they introduced hooks, but brevity isn't one of them, imo