functional components are stateless and class components are stateful. so if you want to store some state, or if you want to use lifecycle methods, we have to use classes.

in react 16.8 we got a new featuer called hooks that allow us to build functional components with all the features we have in class components.so we can use state and lifecycle featuers of class components.

one reason is that classes are a bit difficult for some people to understand, especially new programmers. if you have a good background in object oriented programming classes are second nature for you.

two reason this keyword is confusing in javascript.

the third issue is that writing class components requires a bit of boilerplate code, we have to create a class that extends react component,