Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

944 B

title
title
Use the Lifecycle Method componentWillMount

Use the Lifecycle Method componentWillMount


Problem Explanation

The challenge is a basic introduction to React's LifeCycle components. These methods are also called Lifecycle Hooks.


Hints

Hint 1

Log something to the console in the react componentWillMount method.

Hint 2

The console.log(); statement is used to log to the browser console.


Solutions

Solution 1 (Click to Show/Hide)

Since you can log anything, use the console.log(); and pass in a string. The componentWillMount method should look like:

componentWillMount() {
  console.log('Component being mounted');
}

Note: The componentWillMount Lifecycle method has been deprecated as of version 17, and does not work on later versions. (Source)