UIElement Docs Version 0.13.1

🔗 Function: fromContext()

fromContext<T, C>(context, fallback): (host) => Signal<T>

Defined in: src/core/context.ts:124

Consume a context value for a component.

🔗 Type Parameters

🔗 T

T extends object

🔗 C

C extends HTMLElement

🔗 Parameters

🔗 context

Context<string, Signal<T>>

context key to consume

🔗 fallback

MaybeSignal<T>

fallback value to use if context is not provided

🔗 Returns

  • a function that returns the consumed context signal or a signal of the fallback value

(host): Signal<T>

🔗 Parameters

🔗 host

C

🔗 Returns

Signal<T>

🔗 Since

0.13.1