DEV Community

Discussion on: Reinventing the Wheel With React Hooks

Collapse
 
bytebodger profile image
Adam Nathaniel Davis • Edited

4) I feel entirely confident that I can answer that for you. In fact, it was kinda the underlying point from this post. I'm not even joking or exaggerating when I say I'm convinced that the Redux / Hooks / Abramov team is front-and-center in the JS elitist war against that ugly, nasty, evil, unconscionable class keyword. Seriously. I'm pretty sure that they just hate the idea that they might have to use class in their own code, or see it in anyone else's code.

I'm not claiming that Hooks are a one-to-one port of class-to-function, but they're pretty close. I truly believe that the underlying motivation for the creation of Hooks was a deep desire to "exterminate" that horrible class keyword from the code. And I'm equally confident that the Hooks team would rather saw off their own leg than have to extend any Hooks-based features back into class components.

IMHO, one subtle sign of this is with create-react-app. I use that package frequently whenever I need to spin up a quick, local, proof-of-concept app. It's quick and easy and convenient.

But I started noticing a few years ago that create-react-app's base install changed in a clever little way. Now, when you spin up a new project with it, the default App.js component is created as a functional component - whereas, in the past, it was always created as a class-based component.

Of course, if you still want to use class-based components, it takes all of 30 seconds to change it. And even if you leave the default App.js component as functional, that doesn't stop you from writing new components in the project that are class-based. But I felt that this subtle shift was telling. It was like having Abramov standing behind you and whispering into your ear, "Don't use those rotten no-good class-based components."