# What is the need to unmount a component in React?

**URL:** <https://forum.freecodecamp.org/t/what-is-the-need-to-unmount-a-component-in-react/168656>\
**Category:** General\
**Created:** [January 14, 2018, 4:56pm UTC](https://forum.freecodecamp.org/t/what-is-the-need-to-unmount-a-component-in-react/168656 "2018-01-14T16:56:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidradon](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/davidradon/32/86737_2.png) [@davidradon](https://forum.freecodecamp.org/u/davidradon)\
**Post date:** [January 14, 2018, 4:56pm UTC](https://forum.freecodecamp.org/t/what-is-the-need-to-unmount-a-component-in-react/168656/1 "2018-01-14T16:56:21Z")

</div>

[https://jsfiddle.net/dannymarkov/aLhp9jvg/1/?utm\_source=website&utm\_medium=embed&utm\_campaign=aLhp9jvg](https://jsfiddle.net/dannymarkov/aLhp9jvg/1/?utm_source=website&utm_medium=embed&utm_campaign=aLhp9jvg)

In the above mentioned example why do we need to unmount the timer. It works just fine without unmounting.

---

<div class="post-metadata">

**Author:** ![PortableStick](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/portablestick/32/65591_2.png) [@PortableStick](https://forum.freecodecamp.org/u/PortableStick)\
**Post date:** [January 14, 2018, 5:10pm UTC](https://forum.freecodecamp.org/t/what-is-the-need-to-unmount-a-component-in-react/168656/2 "2018-01-14T17:10:21Z")

</div>

It’s good practice to end any asynchronous activity when you get rid of a component. If you unmount the component without clearing the timer, then the timer is still working in the background. This uses up resources, but more importantly it could affect data in unpredictable ways if the timer’s callback fires when you’re not expecting it to.

---

<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:** [January 17, 2021, 8:30pm UTC](https://forum.freecodecamp.org/t/what-is-the-need-to-unmount-a-component-in-react/168656/3 "2021-01-17T20:30:26Z")

</div>

Closed on January 17, 2021, 8:30pm UTC


