Manage Updates with Lifecycle Methods bug

Manage Updates with Lifecycle Methods bug
0

#1

Tell us what’s happening:

Everything seems to work. My code matches the “hint” code.

Your code so far


class Dialog extends React.Component {
  constructor(props) {
    super(props);
  }
  componentWillUpdate() {
    console.log('Component is about to update...');
  }
  // change code below this line
componentWIllReceiveProps(nextProps){
  console.log(this.props, nextProps);
}
componentDidUpdate(){
  console.log('Component has updated');
}
  // change code above this line
  render() {
    return <h1>{this.props.message}</h1>
  }
};

class Controller extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      message: 'First Message'
    };
    this.changeMessage = this.changeMessage.bind(this);
  }
  changeMessage() {
    this.setState({
      message: 'Second Message'
    });
  }
  render() {
    return (
      <div>
        <button onClick={this.changeMessage}>Update</button>
        <Dialog message={this.state.message}/>
      </div>
    );
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/manage-updates-with-lifecycle-methods/


#2

You have a typo in the following section. Review the challenge instructions for the actual method name to use.

  // change code below this line
componentWIllReceiveProps(nextProps){
  console.log(this.props, nextProps);
}