# Life cycle hooks are getting called twice

**URL:** <https://forum.freecodecamp.org/t/life-cycle-hooks-are-getting-called-twice/386677>\
**Category:** General\
**Created:** [May 10, 2020, 4:03pm UTC](https://forum.freecodecamp.org/t/life-cycle-hooks-are-getting-called-twice/386677 "2020-05-10T16:03:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mizanmahi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mizanmahi/32/129621_2.png) [@mizanmahi](https://forum.freecodecamp.org/u/mizanmahi)\
**Post date:** [May 10, 2020, 4:03pm UTC](https://forum.freecodecamp.org/t/life-cycle-hooks-are-getting-called-twice/386677/1 "2020-05-10T16:03:51Z")

</div>

Whne I start my react app,  
`constructor()` , `getDerivedFromProps()` and `render()` method are getting called twice and componentDidMount is getting called once.  
Shouldn’t all of them are getting called once in the mounting phase?

![react lifecycle](https://global.discourse-cdn.com/freecodecamp/original/3X/d/0/d0d4055ebd8e456538b0656e9df04680a06b3fc3.png)

---

<div class="post-metadata">

**Author:** ![ajnasaju](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ajnasaju/32/167601_2.png) [@ajnasaju](https://forum.freecodecamp.org/u/ajnasaju)\
**Post date:** [May 11, 2020, 4:20pm UTC](https://forum.freecodecamp.org/t/life-cycle-hooks-are-getting-called-twice/386677/2 "2020-05-11T16:20:17Z")

</div>

The life cycle hooks are being called twice because in React strict mode `<React.StrictMode />` the side effects executed twice.So if you unwrap your `<App />` component from `<React.StrictMode>` in `index.js` file it’ll work fine.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:54pm UTC](https://forum.freecodecamp.org/t/life-cycle-hooks-are-getting-called-twice/386677/3 "2021-06-01T18:54:00Z")

</div>

Closed on June 1, 2021, 6:54pm UTC


