-
Notifications
You must be signed in to change notification settings - Fork 49.9k
Closed
Labels
Description
Right now we don't do this consistently, so you could have behavior that varies depending on where you put the mixins key in your class spec. That's not great.
Here's an example: http://jsfiddle.net/zpao/9sW7n/ (using master)
var Mixin = {
componentDidMount: function() {
console.log('Mixin');
}
};
var CompA = React.createClass({
mixins: [Mixin],
componentDidMount: function() {
console.log('CompA');
},
render: function() {
return <span>A</span>;
}
})
var CompB = React.createClass({
componentDidMount: function() {
console.log('CompB');
},
mixins: [Mixin],
render: function() {
return <span>B</span>;
}
})This outputs:
"Mixin"
"CompA"
"CompB"
"Mixin"
I think we should consistently behave like CompB (component, then mixin methods) but @yungsters disagrees. Any other opinions. @petehunt @sebmarkbage @jordwalke
Potentially interested @gaearon (once we figure out which way we go)? This is relatively contained and testable but it does take you right into core.