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.
Utilização
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>
);
}Assinaturas
<T>(fallback: T, name?: string): Inherited<T>Parâmetros de tipo
| Nome | Restrição | Predefinição |
|---|---|---|
T | — | — |
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
fallback | T | Sim | — |
name | string | Não | — |
Devolve
Inherited<T>
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.