Lifecycle Methods
Last updated
Was this helpful?
Last updated
Was this helpful?
CBWIRE provides lifecycle methods you can hook into to update and render your .
The lifecycle methods are executed in the following order when a component is initially loaded:
onMount()
onRender()
Lifecycle methods are executed in this order for subsequent AJAX requests.
onHydrate[DataProperty]()
onHydrate()
onUpdate[DataProperty]()
onUpdate()
Fire actions
onRender()
It runs only once when a component is initially wired. This can inject data values into your component via params you pass in when calling wire(), or pulling in values from the RC or PRC scopes.
onMount() only fires when the component is initially rendered and does not fire on subsequent requests when your component re-renders. This can cause issues referencing things such as the RC or PRC scope. If you pass in values with the RC or PRC scope, you must store them as data properties to ensure they are available to your component in subsequent requests.
It runs on all requests before rendering your component. This gives you more control if needed when rendering. There is also a renderIt() alias, which does the same.
Runs on subsequent requests after a specific data property is hydrated but before computed properties are rendered, before an action is performed, or before the component is rendered.
Runs on subsequent requests after a component is hydrated but before are rendered, before a is updated or is performed, or before the component is rendered.
Runs on subsequent requests after any is updated using wire:model or $set.
Runs on subsequent requests after a is updated using wire:model or $set. It only runs when the targeted data property is updated.