Control the flow of time in your components.
1The Component Lifecycle
A component is instantiated, its template is compiled, it is attached to the DOM (mounted), it updates when data changes, and finally, it is destroyed (unmounted). Vue gives you hooks to run code at each of these stages.
2onMounted
onMounted is the most frequently used hook. It runs after the component has been inserted into the DOM. This is the perfect place to fetch data from an API, initialize a 3D canvas, or interact with native DOM elements.
3onUnmounted
onUnmounted runs right before the component is destroyed. It is absolutely critical for performance: you must use it to remove manual window.addEventListener listeners or clear setInterval timers to prevent memory leaks.
