-
-
Save deniztetik/b25b334e23d31486c3e5cdd76e26abcb to your computer and use it in GitHub Desktop.
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
function logProps(WrappedComponent) { | |
return class extends React.Component { | |
componentDidUpdate(prevProps) { | |
console.log('Previous props: ', prevProps); | |
console.log('Current props: ', this.props); | |
} | |
render() { | |
// Wraps the input component in a container, without mutating it. Good! | |
return <WrappedComponent {...this.props} />; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment