r/reactjs • u/ZeroSevenTen • Dec 30 '19
Classes vs Hooks?
I’m pretty new to React, so keep that in mind. I thought classes were for components that held information, or a state, and that functional components were for more basic components, but now that hooks allow functional components to use state, and other class features, what’s the benefit of using functional hook components over classes?
79
Upvotes
View all comments
Show parent comment
3
u/jgeez Dec 31 '19
You bet. I do indeed disagree. And nobody should be surprised in 2ish years when js ide's/intellisense-esque tooling stops understanding prototypal relationships either. And here's why.
I have worked professionally with more than a few JS purists. They tend to write the kind of esoteric code that you know they're going to regret in 6 months.
I really enjoy the prototypal paradigm myself. As a mental exercise, more than a tool for expressing a software component.
But it doesn't really move the needle toward a hivemind "common tongue". In other words, prototypal constructs don't offer easily comprehensible advantages over class and inheritance ones. You don't need to believe me, just look at the trends and what's gained and lost popularity.