DEV Community

Luca Spezzano
Luca Spezzano

Posted on

11 Vue.js Lifecycle Hooks

Something that you absolutely need to know when you approach Vue.js for the first time is its Lifecycle Hooks.

You can go deep to start writing your JavaScript logic inside methods or computed properties and so on. Of course, I understand that when you are excited about learning a new technology you want to see it in action fast (I did exactly that btw ), but I guarantee you that understanding these Hooks will give you a strong foundation to learn this Javascript Framework.

If you get confused with methods and computed properties when you start with Vue.js, I suggest you read this article.

The Vue instance
The core of Vue.js is its instance. Every Vue application starts by creating one and it is an object that will help you to create your desired behavior.

The Vue instance contains different options[1]: data, props, template, methods, computed, watchers, lifecycles and much more.

As you can imagine the instance is responsible for different things, for example setting data observation, compiling the template, mounting the instance to the DOM, updating the DOM when data changes and others. I invite you to read the documentation here if you are interested to know more about all these arguments.

The Vue lifecycle hooks
The lifecycle hooks are functions that give you the opportunity to add code at specific stages.

To know the 11 Lifecycle Hooks continue to read the article on medium https://medium.com/notonlycss/11-vue-js-lifecycle-hooks-3c8251e1996a

Latest comments (1)

Collapse
 
codemouse92 profile image
Jason C. McDonald

We encourage the entire article to be published on DEV.to (if you have proper rights), with a linkback if appropriate. Otherwise, we recommend original material, such as an original commentary on the article. From the Terms of Use:

Users must make a good-faith effort to share content that is...not designed primarily for the purposes of promotion or creating backlinks. Additionally, posts must contain substantial content — they may not merely reference an external link that contains the full post.

Posts that are simply intended to encourage readers to view an external resource are discouraged.

Thank you.