Skip to content

Component lifecycle

Filatov Dmitry edited this page Aug 12, 2015 · 32 revisions

onInit

void onInit()

The callback which will be invoked after a component has been created. It's a good place to create initial state for the stateful components.

onRender

VNode onRender(
    Object attrs,
    Array children
)

The callback which will be invoked when a component should be rendered. It's an essential part of component lifecycle. It should return based on attrs, children and possible internal state of a component. This method is supposed to be pure, it should have no side effects.

onMount

void onMount(
    Object attrs
)

The callback which will be invoked after a component has been mounted to the DOM.

onAttrsReceive

void onAttrsReceive(
    Object newAttrs,
    Object prevAttrs
)

onUpdate

void onUpdate(
    Object attrs
)

The callback which will be invoked after a component has updated its DOM.

onUnmount

void onUnmount()

The callback which will be invoked before a component is unmounted from the DOM.