# What is the difference between mounted() and ionViewDidEnter()?

**URL:** <https://forum.ionicframework.com/t/what-is-the-difference-between-mounted-and-ionviewdidenter/215154>\
**Category:** Ionic Vue\
**Created:** [September 17, 2021, 10:03pm UTC](https://forum.ionicframework.com/t/what-is-the-difference-between-mounted-and-ionviewdidenter/215154 "2021-09-17T22:03:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dillonvuong](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@dillonvuong](https://forum.ionicframework.com/u/dillonvuong)\
**Post date:** [September 17, 2021, 10:03pm UTC](https://forum.ionicframework.com/t/what-is-the-difference-between-mounted-and-ionviewdidenter/215154/1 "2021-09-17T22:03:30Z")

</div>

I was looking at a way to get get the reference to DOM elements in created() but it returned null. Then I found that you can do it with ionViewDidEnter(). There is also mounted() which I am thinking does the same thing so can someone please clarify?

---

<div class="post-metadata">

**Author:** ![marsnebulasoup](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@marsnebulasoup](https://forum.ionicframework.com/u/marsnebulasoup)\
**Post date:** [September 18, 2021, 3:38am UTC](https://forum.ionicframework.com/t/what-is-the-difference-between-mounted-and-ionviewdidenter/215154/2 "2021-09-18T03:38:56Z")

</div>

Ionic caches views, and as such, components/views may not be re-rendered when navigated to more than once, and therefore `mounted()` or `created()` wouldn’t be called more than once (since they’re only called when the component/view is being rendered). `ionViewDidEnter()`, on the other hand, is called each time a view is routed to.

Also note that you cannot access the DOM in `created()` since it’s called before render (see image below), use `mounted()` instead, or `ionViewDidEnter()`, if you want to access the DOM again each time the view is navigated to.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/8/9/894273fd975be72a1b8cda2b8b3a202ec2efea28.png)

---

<div class="post-metadata">

**Author:** ![ldebeasi](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ldebeasi/32/147501_2.png) [@ldebeasi](https://forum.ionicframework.com/u/ldebeasi)\
**Post date:** [September 20, 2021, 3:52pm UTC](https://forum.ionicframework.com/t/what-is-the-difference-between-mounted-and-ionviewdidenter/215154/3 "2021-09-20T15:52:43Z")

</div>

The above answer is correct regarding Ionic lifecycle hooks. You can find more information on this at [Vue Lifecycle - Ionic Documentation](https://ionicframework.com/docs/vue/lifecycle).
