DEV Community

Discussion on: Reinventing the Wheel With React Hooks

Collapse
timoglastra profile image
Timo Glastra

I agree for a big part with your article. People are always using the next big thing, but that doesn’t mean it is better than the previous thing.

However, for me, hooks provide a new way to reuse specific logic. I can simply import ‘useAnything‘ and it works. Whereas with classes this isn’t possible due to different lifecycle methods. Hooks allow me to split code by functionality, not lifecycle. With classes you would need HOCs or render props to achieve the same.

So no hooks are not always better, or more readable than classes. But, for me, often they are. Luckily both are here to stay.

Collapse
bytebodger profile image
Adam Nathaniel Davis Author

Good points. Hooks certainly have some advantages. I'll explore those a little further in a future post.

Collapse
talha131 profile image
Talha Mansoor

People are always using the next big thing, but that doesn’t mean it is better than the previous thing.
However, for me, hooks provide a new way to reuse specific logic.

You can say that again.

Another point I would like to add is when the community wholeheartedly moves towards the new thing, the momentum it creates forces the people sitting on the fence to follow the herd.

The latest and chic technique gets the majority mindshare. All new libraries get developed using the new thing. Old libraries that used past practices fall into disuse and stop getting the updates and fixes.

Modern web applications rely on so many libraries that size of node_modules is a running joke. It is turtles all the down. So for better or for worse, one has to follow the latest trends.