Here we are changing all class components to functional components using hooks. Depending on component complexity we don't change for now. But this is not a rule, actually, this is not recommended. here is a React blog that covers this.


Using class components is "mildly discouraged". Which means writing new code mostly using function components (unless there are compelling reasons not to) and not spending any time/resourses on rewriting existing codebase to move from class components to their functional counterparts.

An example of a compelling reason to use class component would be the need to optimise the component that uses Redux (e.g. is connected to Redux store) for performance to the extent beyond what hooks allow.

Related Query

More Query from same tag