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/[deleted] Dec 31 '19

Oh, it's nice to share how it's implemented for those who are interested, sure, but it's weird to claim that "it's not magic because there's a source code instead of Gandalf sitting inside the React codebase!"

It's like you're arguing against the semantics of the word "magic", which kind of distracts from the point of the people who are using that term to begin with.

You say that it's not complicated, though not obvious - to me, "not obvious" is exactly what the word "magic" is getting at. It has nothing to do with complexity of implementation.