useCell
The useCell hook returns a reactive object reflecting the value of a Cell in a Row in a Table, and registers a listener so that any changes to that Cell will update .current.
useCell(
tableId: MaybeGetter<string>,
rowId: MaybeGetter<string>,
cellId: MaybeGetter<string>,
storeOrStoreId?: MaybeGetter<undefined | StoreOrStoreId>,
): {current: CellOrUndefined}| Type | Description | |
|---|---|---|
tableId | MaybeGetter<string> | |
rowId | MaybeGetter<string> | |
cellId | MaybeGetter<string> | |
storeOrStoreId? | MaybeGetter<undefined | StoreOrStoreId> | |
| returns | {current: CellOrUndefined} | A reactive object with a |
Example
This example uses the useCell hook to display a Cell value reactively.
// In a .svelte file:
// const store = createStore().setCell('pets', 'cat', 'name', 'Fido');
// const name = useCell('pets', 'cat', 'name', store);
// $: console.log(name.current); // 'Fido'
Since
v8.1.0