Created
April 28, 2019 00:31
-
-
Save williamsiuhang/8cc5925853a989ac8a04d2d03b495064 to your computer and use it in GitHub Desktop.
Method to determine if state or prop is updated
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
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