is there ever a situation where one would absolutely need a class component?

There are a very small number of rare situations that only class components support at the moment. As the Hooks FAQ puts it:

Our goal is for Hooks to cover all use cases for classes as soon as possible. There are no Hook equivalents to the uncommon getSnapshotBeforeUpdate, getDerivedStateFromError and componentDidCatch lifecycles yet, but we plan to add them soon.

It is very unusual for a script-writer to need those, though not completely impossible. Odds are high that every situation you encounter will be achievable using functional components.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top