17 lines
363 B

// highlight-next-line
function logProps(WrappedComponent) {
class LogProps extends React.Component {
componentDidUpdate(prevProps) {
console.log('old props:', prevProps);
console.log('new props:', this.props);
}
render() {
// highlight-next-line
return <WrappedComponent {...this.props} />;
}
}
return LogProps;
}