What are life cycle hooks in VueJs?

  • beforeCreate - The first component in the creation of hooks. This allows us to perform actions before our component has been added to DOM. We don't have access to DOM inside of this hook.
  • Created -This hook is invoked when Vue has set up events and data observations. Here, events are active and access to reactive data is enabled through templates that have not yet been mounted or rendered.
  • beforeMount - The beforeMount hooks runs right before the initial render happens and after the template or render functions have complied.
  • Mounted - This is a most used hook and you will have full access to the reactive component, templates, and rendered DOM (via. this.$el). The most frequently used patterns are fetching data for your component.
  • beforeUpdate - This hook runs after data changes on our component and the update cycle begins. But it runs right before the DOM is patched and re-renders.
  • Updated - This hook runs after data changes on your component and the DOM re-renders.
  • beforeDestroy -  This hook will run before destroying the Vue instance.
  • Destroyed - This hook is called after your component has been destroyed, its directives have been unbound and its event listeners have been removed

Comments

Popular posts from this blog

Basic Terminology

What is normalization in DBMS?

Object oriented programming concepts in PHP