Code Editor
Web Browser
Mounting Lifecycle Methods


The final mounting lifecycle method is called componentDidMount.

When a component renders for the first time, componentDidMount gets called right after the HTML from render has finished loading. Look in the code editor for an example of componentDidMount.

componentDidMount gets used a lot!

If your React app uses AJAX to fetch initial data from an API, then componentDidMount is the place to make that AJAX call. More generally, componentDidMount is a good place to connect a React app to external applications, such as web APIs or JavaScript frameworks. componentDidMount is also the place to set timers using setTimeout or setInterval.

If that sounds vague, don't worry. You'll put lifecycle methods into practice in this course's final project, and then more in the next course! Not to mention in the real world...

Report a Bug
If you see a bug or any other issue with this page, please report it here.