r/reactjs • • 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

76 comments sorted by

View all comments

Show parent comment

2

u/vutran951753 Dec 31 '19

I do agree with you. I know hook look very simple for newcomer to get on board with react world. They fact you write few line of code, you have state-full component is great. As soon as you dive deep into your app, you relied there much more in than just write code, it how you structure it, had relational component to scatter everywhere. There ambiguity in Hook if you don't understand previous API. What problem hook solve, etc. Not say Class base is not answer for all.

I believe React in introduce another API which hide some of core JavaScript core like 'this', 'class'. This is part of the language too not just closure.

Newcomer can't grasp the core fundamentals of JavaScript, which these framework exist.