Created
September 6, 2016 22:19
-
-
Save alyssaBiasi/8b84846bcde98c3b9d2d22a8081eff98 to your computer and use it in GitHub Desktop.
REA ReactJS Performance Debugging "WhyYouUpdate Higher Order 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
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