Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
check performance issues
import { PureComponent } from 'react';
PureComponent.componentDidUpdate = prevProps => {
const name =
this.constructor.displayName || this.constructor.name || 'Component';
console.group(name);
Object.keys(prevProps).forEach(key => {
if (prevProps[key] !== this.props[key]) {
console.log(
`property ${key} changed from ${prevProps[key]} to ${
this.props[key]
}`
);
}
});
console.groupEnd(name);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.