TinyBase logoTinyBase β

delRow

The delRow method lets you remove a single Row from a Table.

delRow(
  tableId: string,
  rowId: string,
): this
TypeDescription
tableIdstring

The Id of the Table in the Store.

rowIdstring

The Id of the Row in the Table.

returnsthis

A reference to the Store.

If this is the last Row in its Table, then that Table will be removed.

Example

This example removes a Row from a Table.

import {createStore} from 'tinybase';

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

console.log(store.getTables());
// -> {pets: {felix: {species: 'cat'}}}

Since

v1.0.0