Created
April 2, 2017 16:01
-
-
Save webuniverseio/3a5ed8806c2404e2d585ae925ca86aa5 to your computer and use it in GitHub Desktop.
react-redux forceUpdate
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
componentDidMount() { | |
let prevState = this.props.getState(); | |
this.unsubscribe = | |
this.props.subscribe(() => { | |
const state = this.props.getState(); | |
if (state != prevState) { | |
this.forceUpdate(); | |
prevState = state; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment