inherit
Called while a component sets up: the value the nearest component above it
provides for key, or the key's fallback, as a signal its JSX follows.
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>): ReadonlySignal<T>Type parameters
| Name | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | Inherited<T> | Yes | — |
Returns
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.