4 ms·
"extends" is often a bad idea. https://en.wikipedia.org/wiki/Composition_over_inheritance https://en.wikipedia.org/wiki/Composition_over_inheritance It's sad t
by EugeneOZ 10y ago
"extends" is often a bad idea. https://en.wikipedia.org/wiki/Composition_over_inheritance https://en.wikipedia.org/wiki/Composition_over_inheritance
It's sad to see how new generation can't learn lessons of the past.
- danabramov 10y agoYes 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.