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.
Verwendung
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>
);
}Signaturen
<T extends object>(initial: T, name?: string): TTypparameter
| Name | Einschränkung | Standard |
|---|---|---|
T | object | — |
Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
initial | T | Ja | — |
name | string | Nein | — |
Rückgabe
T
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.