Skip to content

Instantly share code, notes, and snippets.

@williamsiuhang
Created April 28, 2019 00:31
Show Gist options
  • Save williamsiuhang/8cc5925853a989ac8a04d2d03b495064 to your computer and use it in GitHub Desktop.
Save williamsiuhang/8cc5925853a989ac8a04d2d03b495064 to your computer and use it in GitHub Desktop.
Method to determine if state or prop is updated
componentDidUpdate(prevProps, prevState) {
if (this.state !== prevState) {
// update redux state when Information.js state updates
this.props.updateNewEventInfo(this.state);
}
if (prevProps.eventcreation !== this.props.eventcreation) {
// redux prop is updated in component prop (slight delay between redux / prop updates)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment