Skip to content

component

wybthon.component

Component base classes for class-based VDOM components.

BaseComponent

Bases: ABC

Async component base that renders to a concrete DOM Element.

render() abstractmethod async

Render this component and return its root Element.

render_children(parent) async

Render and append all child components to the given parent element.

Component

Class component base for the VDOM renderer.

Subclasses should implement render(self) -> VNode. Lifecycle hooks: - on_mount(self) - on_update(self, prev_props: dict) - on_unmount(self)

add_cleanup(fn)

Register a cleanup callback to run on unmount.

on_mount()

Called after the component is first mounted.

on_unmount()

Called before the component is removed from the DOM.

on_update(prev_props)

Called after props update and render diff applied.