store
A store over initial, which it wraps rather than copies: every path is a
signal. A read inside JSX (item.liked) follows that path alone, and a
write through the store (items[3].liked = true, items.push(next))
updates only the bindings that read what changed. Made while a component
sets up, it belongs to that component's slot, as signal() does.
Utilisation
Render a short checklist
import { For, Scroll, Text, store } from 'kuito';
export function PackingList() {
const state = store({ items: [{ title: 'Passport' }, { title: 'Tickets' }] });
return (
<Scroll>
<For each={state.items} fallback={<Text>Add your first item</Text>}>
{(item, index) => <Text padding={12}>{`${index.value + 1}. ${item.title}`}</Text>}
</For>
</Scroll>
);
}Signatures
<T extends object>(initial: T, name?: string): TParamètres de type
| Nom | Contrainte | Par défaut |
|---|---|---|
T | object | — |
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
initial | T | Oui | — |
name | string | Non | — |
Retourne
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.