Function: Ctx()

function Ctx<This, Value>(mapper?: (value: Value | undefined, self: This) => Value): (target: undefined, context: ClassFieldDecoratorContext<This, Value>) => (this: This, initialValue: Value) => Value;

Defined in: src/reactivity/decorators/ctx.ts:16

Type Parameters

Type Parameter
This extends object
Value

Parameters

Parameter Type Description
mapper? (value: Value | undefined, self: This) => Value Una función opcional para transformar el valor recibido del padre.

Returns

(target: undefined, context: ClassFieldDecoratorContext<This, Value>): (this: This, initialValue: Value) => Value;

Parameters

Parameter Type
target undefined
context ClassFieldDecoratorContext<This, Value>

Returns

(this: This, initialValue: Value): Value;

Parameters

Parameter Type
this This
initialValue Value

Returns

Value

Ctx

es un decorador que crea una propiedad reactiva contextual. La propiedad hereda su valor del primer componente padre que provea un contexto con el mismo nombre. Si no encuentra un padre, usa su valor inicial.