Skip to content

Lifecycle

Neila edited this page Aug 13, 2024 · 1 revision

Lifecycle

Use addLifecycleEvent to add lifecycle hooks.

Mount Event

The mount event is triggered when the component is first rendered.

function Foo() {
    addLifecycleEvent("mount", () => {
        // ...
    });
}

Unmount Event

The Unmount event is triggered when a component is about to be unmounted.

function Foo() {
    addLifecycleEvent("unmount", () => {
        // ...
    });
}
Clone this wiki locally