Created
February 9, 2015 07:18
-
-
Save omahlama/ff5a879ca209b3b1d287 to your computer and use it in GitHub Desktop.
Mixin for react components that have a Bacon.model named "model" as a property
This file contains 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
var BaconModelMixin = { | |
componentDidMount: function() { | |
this.unsubscribe = this.props.model.onValue(this.setState.bind(this)); | |
}, | |
componentWillUnmount: function() { | |
if(this.unsubscribe) { | |
this.unsubscribe(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment