Skip to content

Instantly share code, notes, and snippets.

@lowiebenoot
Created June 20, 2017 09:21
Show Gist options
  • Save lowiebenoot/e3dbc529380b6a4a1a5c00edec136142 to your computer and use it in GitHub Desktop.
Save lowiebenoot/e3dbc529380b6a4a1a5c00edec136142 to your computer and use it in GitHub Desktop.
Log why a react component rendered
componentDidUpdate(prevProps) {
Object.keys(this.props).forEach(key => {
if (this.props[key] !== prevProps[key]) {
console.log(key, "changed from", prevProps[key], "to", this.props[key]);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment