getCell
The getCell
method returns an object containing the value of a single Cell
in a given Row
, in a given Table
.
getCell(
tableId: string,
rowId: string,
cellId: string,
): undefined | Cell
Type | Description | |
---|---|---|
tableId | string | |
rowId | string | |
cellId | string | |
returns | undefined | Cell | The value of the Cell. |
Note that this returns a copy of, rather than a reference to the underlying data, so changes made to the returned object are not made to the Store
itself.
Examples
This example retrieves a single Cell
.
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
.
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
console.log(store.getCell('pets', 'fido', 'color'));
// -> undefined