inherited
A value descendants inherit, as a CSS property is inherited. Made once, as
a const at the top of a module: the compiler names it after its file and
variable, so it stays the same key across Live Patches.
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>(fallback: T, name?: string): Inherited<T>Type parameters
| Name | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
fallback | T | Yes | — |
name | string | No | — |
Returns
Inherited<T>
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.