Michael Landis
Mar 15, 2021

I see how a class can be extended, but I worry about highlighting this without caveating that even the React docs warn against extension in favor of composition and inversion control.

As it reads now, I can definitely imagine a newbie OOP programmer exclaiming, “ooo, that must be the way to make React *really* shine” and get into a world of trouble.

The main reason I can see for using classes in React is strictly for error boundaries, which can only be created using classes. Otherwise, React is really more aligned with FP fundamentals versus OOP.

Michael Landis
Michael Landis

Written by Michael Landis

Front-end web developer, React enthusiast, vagabond.

Responses (1)