Skip to content

context

wybthon.context

Tiny context system for passing values through the component tree.

Context dataclass

Opaque context identifier and default value container.

Provider(props)

Context provider component (function component).

Renders its children transparently. The reconciler handles pushing and popping context values around this component's subtree mount.

Props
  • context: Context
  • value: Any
  • children: VNode or list of VNodes

create_context(default)

Create a new Context with a unique identifier and default value.

pop_provider_value()

Pop the latest provider scope from the context stack if present.

push_provider_value(ctx, value)

Push a new provider value for ctx onto the context stack.

use_context(ctx)

Read the current value for ctx, or its default if not provided.