In Vue.js, when a component is loaded, the lifecycle hooks mounted
and created
may be called once each.
The created
hook is called when the component's instance is created, but the component's DOM has not yet been mounted or rendered. This hook is commonly used for initializing data or setting up event listeners.
The mounted
hook is called after the component's DOM has been mounted or inserted into the document. This hook is often used for accessing the component's rendered DOM elements or making API calls.
It's important to note that the created
hook is called before the mounted
hook. However, in some cases, such as when using dynamic components or conditional rendering, the component may be created and mounted multiple times.
To summarize, in most scenarios, the created
and mounted
hooks are called once each when a component is loaded. However, certain situations can result in the component being created and mounted multiple times.
before load component and after load componetn -> once each
No comments:
Post a Comment