TinyBase logoTinyBase


The setCell method sets the value of a single Cell in the Store.

  tableId: string,
  rowId: string,
  cellId: string,
  cell: Cell | MapCell,
): Store

The Id of the Table in the Store.


The Id of the Row in the Table.


The Id of the Cell in the Row.

cellCell | MapCell

The value of the Cell to be set, or a MapCell function to update it.


A reference to the Store.

This method will cause listeners to be called for any Table, Row, Cell, or Id changes resulting from it.

If the Cell value is invalid (either because of its type, or because it does not match a TablesSchema associated with the Store), will be ignored silently.

As well as string, number, or boolean Cell types, this method can also take a MapCell function that takes the current Cell value as a parameter and maps it. This is useful if you want to efficiently increment a value without fetching it first, for example.

The method returns a reference to the Store so that subsequent operations can be chained in a fluent style.


This example sets the value of a single Cell.

const store = createStore().setCell('pets', 'fido', 'species', 'dog');
// -> {pets: {fido: {species: 'dog'}}}

This example sets the data of a single Cell by mapping the existing value.

const increment = (cell) => cell + 1;
const store = createStore().setTables({pets: {fido: {visits: 1}}});

store.setCell('pets', 'fido', 'visits', increment);
console.log(store.getCell('pets', 'fido', 'visits'));
// -> 2

This example attempts to set the data of an existing Store with an invalid Cell value.

const store = createStore().setTables({pets: {fido: {species: 'dog'}}});

store.setCell('pets', 'fido', 'bug', []);
// -> {pets: {fido: {species: 'dog'}}}