mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 04:12:34 +00:00
17 lines
363 B
JavaScript
17 lines
363 B
JavaScript
// 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;
|
|
}
|