Skip to content

Instantly share code, notes, and snippets.

@webuniverseio
Created April 2, 2017 16:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webuniverseio/3a5ed8806c2404e2d585ae925ca86aa5 to your computer and use it in GitHub Desktop.
Save webuniverseio/3a5ed8806c2404e2d585ae925ca86aa5 to your computer and use it in GitHub Desktop.
react-redux forceUpdate
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