Created
June 14, 2020 11:30
-
-
Save jeffellis/404cd25963e4c9248a8bd4a1cbafc4e1 to your computer and use it in GitHub Desktop.
React: Determine Which Props Caused a Render in a Class Component
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
componentWillReceiveProps(nextProps) { | |
for (const index in nextProps) { | |
if (nextProps[index] !== this.props[index]) { | |
console.log(index, this.props[index], '-->', nextProps[index]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment