There are 13 of Vue’s lifecycle hooks according to the latest Official Vue documentation. Every Vue instance that created will go through lifecycle hooks. Here are the Vue’s lifecycle hooks will explain in this article:
_destroyed_
_ and _beforeDestroy_
lifecycle hooks (in Vue.js 3.0.0+) are deprecated._
Another 5 of Vue’s lifecycles hooks are explained in Part 2which included activated, deactivated, errorCaptured, renderTracked, and renderTriggered**.**
Vue declares and knows data properties in these two phases. We can fetch the data from the server-side in the created hook before render the Vue component. The difference between is the
beforeCreated hook is before an instance has been fully initialized whereas the created
hook is after an instance is created.
beforeCreate and created
Output in the browser
beforeMounthook is starting to compile and render the HTML template. Vue creates a template based on our HTML code combine with the data properties and uses this template to create the real HTML code which then is rendered as the DOM in the
mounted hook.
beforeMount and mounted
Output in the browser
#vue #javascript #programming #developer