Browse Source

Replaced cWRP in forwardRef example with cDU

main
Brian Vaughn 7 years ago
parent
commit
01c26919b4
  1. 6
      examples/forwarding-refs/log-props-after.js
  2. 6
      examples/forwarding-refs/log-props-before.js

6
examples/forwarding-refs/log-props-after.js

@ -1,8 +1,8 @@
function logProps(WrappedComponent) {
class LogProps extends React.Component {
componentWillReceiveProps(nextProps) {
console.log('old props:', this.props);
console.log('new props:', nextProps);
componentDidUpdate(prevProps) {
console.log('old props:', prevProps);
console.log('new props:', this.props);
}
render() {

6
examples/forwarding-refs/log-props-before.js

@ -1,9 +1,9 @@
// highlight-next-line
function logProps(WrappedComponent) {
class LogProps extends React.Component {
componentWillReceiveProps(nextProps) {
console.log('old props:', this.props);
console.log('new props:', nextProps);
componentDidUpdate(prevProps) {
console.log('old props:', prevProps);
console.log('new props:', this.props);
}
render() {

Loading…
Cancel
Save