Skip to content

Instantly share code, notes, and snippets.

@alyssaBiasi
Created September 6, 2016 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alyssaBiasi/8b84846bcde98c3b9d2d22a8081eff98 to your computer and use it in GitHub Desktop.
Save alyssaBiasi/8b84846bcde98c3b9d2d22a8081eff98 to your computer and use it in GitHub Desktop.
REA ReactJS Performance Debugging "WhyYouUpdate Higher Order Component"
const WhyYouUpdate = Component => {
class WhyYouUpdate extends React.Component {
componentDidUpdate(prevProps, prevState) {
deepDiff(
{ props: prevProps, state: prevState },
{ props: this.props, state: this.state },
Component.displayName
);
}
render() {
return <Component {...this.props} />;
}
}
return WhyYouUpdate;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment