getCell
The getCell
method returns the value of a single Cell
in a given Row
, in a given Table
.
getCell(
tableId: string,
rowId: string,
cellId: string,
): CellOrUndefined
Type | Description | |
---|---|---|
tableId | string | |
rowId | string | |
cellId | string | |
returns | CellOrUndefined | The value of the |
Examples
This example retrieves a single Cell
.
import {createStore} from 'tinybase';
const store = createStore().setTables({
pets: {fido: {species: 'dog', color: 'brown'}},
});
console.log(store.getCell('pets', 'fido', 'species'));
// -> 'dog'
This example retrieves a Cell
that does not exist, returning undefined
.
import {createStore} from 'tinybase';
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
console.log(store.getCell('pets', 'fido', 'color'));
// -> undefined
Since
v1.0.0