3 ms·
Yes and in fact it is right in our docs. https://facebook.github.io/react/docs/composition-vs-inheritance.html https://facebook.github.io/react/docs/compositio
by danabramov 10y ago
Yes and in fact it is right in our docs.
https://facebook.github.io/react/docs/composition-vs-inheritance.html https://facebook.github.io/react/docs/composition-vs-inherit...
>So What About Inheritance?
>At Facebook, we use React in thousands of components, and we haven't found any use cases where we would recommend creating component inheritance hierarchies.
We dislike inheritance as much as you do, but we also dislike ad hoc class systems that have worse performance.
- EugeneOZ 10y agoExample with "extends" is also in your docs (exactly by link of this post), so I'm not sure what it proves.
- seattle_spring 10y agoThat's extending the base react component class, not an existing component class.