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.
Utilisation
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>Paramètres de type
| Nom | Contrainte | Par défaut |
|---|---|---|
T | — | — |
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
fallback | T | Oui | — |
name | string | Non | — |
Retourne
Inherited<T>
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.