Prior to the release of React Hooks, we all used class components, higher-order components and React lifecycle methods… they worked and are still working properly, but in some cases, they can also be a struggle to write. This so-called “old” style of writing code in React can sometimes be troublesome, unclean and hard to manage. And that’s where hooks come to the rescue!
This new style of coding sets many ReactJS developers’ minds at ease. But wait, it sometimes isn’t that easy to just flip the switch and use hooks. There are plenty of projects that are fully based on class components… and then there’s the unfinished projects.

What do we do with those? How do we approach further development of such cases? Well, I’ll give you some of the answers right here.

The focus of this blog will mainly be a comparison between class component and hooks style of coding, as well as what to do to transfer between the two. But before we start…

#react #react-hooks #javascript

Using React Hooks in Projects with Existing Class Components
1.90 GEEK