Re:React: Mixins Considered Harmful
by danabramov on Thursday July 14, 2016 @09:04AM
(#12093353)
In our experience inheritance causes a lot of hard-to-find issues, and muddles boundaries between component concerns. Some of the same problems I described we had in mixins also apply to inheritance.
>and you lose the nice function-composition-like behaviour provided by `super.method`.
We found this to be an anti-pattern. It’s easy to get lost in virtual calls across hierarchy, and people are going to create virtual methods (and override them) if you allow it.
>Instead you get hacks like `hoist-non-react-statics` to copy them over manually.
An alternative is to just not put static methods on component. It’s not such a useful feature.
>and you lose the nice function-composition-like behaviour provided by `super.method`.
We found this to be an anti-pattern. It’s easy to get lost in virtual calls across hierarchy, and people are going to create virtual methods (and override them) if you allow it.
>Instead you get hacks like `hoist-non-react-statics` to copy them over manually.
An alternative is to just not put static methods on component. It’s not such a useful feature.