Functional Components vs Class Components in React

Old version of React:

Functional components – produce JSX to show content

Class components –
produce JSX to show content,
use the lifecycle method system,
use the state system

New version of React:
Functional components can:
Express things at a certain time with Hooks instead of the lifecycle method system class components are using.
use the state system can now be done with Hooks

There is no longer need to use Class components and Function components are the new way to go, there is still necessary to learn both ways as you are likely to come across code that are written in both ways, also in order to refactor code from Class Components to Function components you need to understand how they are built.

It can also be argued that its easier to learn the Hooks system after you gather knowledge about Class Components and understand how that works first.

Add your comment