Skip to content

Instantly share code, notes, and snippets.

@jeffellis
Created June 14, 2020 11:30
Show Gist options
  • Save jeffellis/404cd25963e4c9248a8bd4a1cbafc4e1 to your computer and use it in GitHub Desktop.
Save jeffellis/404cd25963e4c9248a8bd4a1cbafc4e1 to your computer and use it in GitHub Desktop.
React: Determine Which Props Caused a Render in a Class Component
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