when we try to load a component how many times a mounted and created called in vues


 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

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...