provide
Called while a component sets up: its descendants inherit value for
key. A signal (a computed too) is what they read: a write reaches the
bindings that read it, and nothing re-renders.
Usage
Share a value with descendants
import { Text, VStack, inherit, inherited, provide, signal } from 'kuito';
const Currency = inherited('EUR');
function Price() {
const currency = inherit(Currency);
return <Text>{`12 ${currency.value}`}</Text>;
}
export function Checkout() {
const currency = signal('USD');
provide(Currency, currency);
return (
<VStack>
<Price />
</VStack>
);
}Signatures
<T>(key: Inherited<T>, value: T | ReadonlySignal<T>): voidType parameters
| Name | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | Inherited<T> | Yes | — |
value | T | ReadonlySignal<T> | Yes | — |
Returns
void
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.