CES Vue and ReactJS
CES Vue and ReactJS
📌 1. Vue.js Lifecycle Hooks
Vue provides various lifecycle hooks that allow you to add code at specific stages of a component's life:
✅ beforeCreate – Runs after instance initialization, before data observation and events setup.
✅ created – Runs after data observation and events are set up. API calls and data initialization are often done here.
✅ beforeMount – Called before mounting begins, i.e., before the DOM is rendered.
✅ mounted – Called after the component is mounted to the DOM. You can access the DOM elements here.
✅ beforeUpdate – Called before the DOM updates when reactive data changes.
✅ updated – Called after the DOM has been updated. Use with caution to avoid infinite loops.
✅ beforeUnmount (Vue 3) – Called before a component is unmounted.
✅ unmounted (Vue 3) – Called after a component is removed from the DOM.
🔗 Example usage:
Comments
Post a Comment