Use the Lifecycle Method componentWillMount 5

Tell us what’s happening:
Unfortunately, getting stuck on this one. I’m not sure what to input in the code, but I also forgot how to input things in it, since my crazy brain doesn’t want to work this morning.

Your code so far


class MyComponent extends React.Component {
  constructor(props) {
    super(props);
  }
  componentWillMount() {
    // change code below this line
    
    // change code above this line
  }
  render() {
    return <div />
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36 Avast/75.1.1528.101.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/use-the-lifecycle-method-componentwillmount/

It is asking you to log something to the console, that’s all, you can log anything you want.

So, if I wanted to log, say like a name of a dog, how would I put that? (Sorry, real sick here lately)

To log to the console a name of a dog you can use

console.log("a name of a dog");

Here is the link to the w3schools reference page.

Happy coding :wink:

1 Like

Thanks, but I put in this:

console.log("Buddy");

And it worked perfectly. I wanted to put my dog’s name in, and it worked.