Tuesday, May 24, 2022

The Difference between Created and Mounted in Vue

In a previous article, I covered all the different lifecycle hooks in Vue. One of the things that most people get confused about when talking about lifecycle hooks, is the difference between created and mounted. They both have similar names, and they feel like they should do the same thing, but there are some subtle differences.

The Difference between Created and Mounted in Vue

To begin with, both created() and mounted() have access to the data and props on your prototype. For example, both hooks will console log 'My Message' below, as well as the default value for myProp, which is 'Some Prop':



from DZone.com Feed https://ift.tt/Mn1OFKE

No comments:

Post a Comment