Created
January 16, 2014 18:17
-
-
Save jchris/8460290 to your computer and use it in GitHub Desktop.
you implement this.setStateForProps(newProps, oldProps) and call this.setState() from there
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.StateForPropsMixin = { | |
componentWillReceiveProps: function(newProps) { | |
// console.log("StateForPropsMixin componentWillReceiveProps", newProps, this.props) | |
this.setStateForProps(newProps, this.props) | |
}, | |
componentWillMount: function() { | |
// console.log("StateForPropsMixin componentWillMount", this.props) | |
this.setStateForProps(this.props) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment