When to use a Class Component over a Function Component


From version 16.8 react supports hooks in function-based components as well. Before this lifecycle components and some other features were only available to the class-based component.

Some companies use class-based because of their old codebase. While some companies use functional components It is better to learn both.

Follow up: How to create a component.