Comment

Comment by danabramov

>I worry this suggests an opposition to inheritance in general. Sharing code through class hierarchy is incredibly useful and common.

This is indeed opposition to inheritance in general, precisely because we tried it, and it doesn’t work great in React apps. React has a strong composition model that does not need inheritance.

https://discuss.reactjs.org/t/best-practices-for-extending-s...

Of course you are free to use inheritance for other purposes. (Or even React components if you insist.) But as the team behind this library, we strongly suggest you to use composition instead of inheritance when defining React components.

parent danabramov 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton