Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.