Inherited
A value a component provides to its descendants, read with inherit()
wherever they are below it. fallback is what they read when no
component above them provides one.
Usage
Share a value with descendants
This type is used by inherit
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>
);
}Type declaration
export interface Inherited<T> {
readonly fallback: T;
}Members 1
| Name | Type | Required | Description |
|---|---|---|---|
fallbackreadonly | T | Yes | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.