Lifecycles
MountLifeCycles
Bases: HydratorVirtualDomAdapter
This class provides lifecycle methods for components that are mounted to the DOM.
It inherits from the HydratorVirtualDomAdapter
class, which provides methods for interacting with the virtual DOM.
Source code in zenaura/client/dom/lifecycles/mount.py
attached(comp)
async
This method is called after the component is mounted to the DOM.
It allows the component to perform any necessary actions after it has been added to the DOM, such as:
- Initializing state
- Setting up event listeners
- Making API calls
- Performing animations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp |
An instance of the Component class. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in zenaura/client/dom/lifecycles/mount.py
RenderLifeCycle
This class provides lifecycle methods for components that are rendered to the DOM.
It allows components to perform actions before and after they are updated and re-rendered in the DOM.
Source code in zenaura/client/dom/lifecycles/render.py
on_mutation(comp)
async
This method is called after the component is updated in the DOM and re-rendered.
It allows the component to perform any necessary actions before the update is applied, such as:
- Updating state based on new props
- Setting up event listeners
- Making API calls
- Performing animations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp |
An instance of the Component class. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in zenaura/client/dom/lifecycles/render.py
on_settled(comp)
async
This method is called after the component is updated in the DOM and re-rendered.
It allows the component to perform any necessary actions after the update is applied, such as:
- Focusing on an input element
- Scrolling to a specific position
- Triggering custom events
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comp |
An instance of the Component class. |
required |
Returns:
Type | Description |
---|---|
None
|
None |