Created
April 9, 2016 20:26
-
-
Save atuttle/ae89e9e5cf8163d66c6e94f1fa8a389b to your computer and use it in GitHub Desktop.
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
var store = require('store') //my redux store | |
var unsubscribe | |
var MyComponent = React.createClass({ | |
componentDidMount: function componentDidMount(){ | |
unsubscribe = store.subscribe(function handleStateChange(){ | |
// in ES6 we could do this: this.forceUpdate() | |
// but what is the solution for ES<6? | |
}) | |
} | |
,componentWillUnmount: function componentWillUnmount() { | |
unsubscribe() | |
} | |
,render: function render() { | |
var state = store.getState() | |
//... | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment