SimpleSharedState

Classes

Store

Members

(static, constant) deleted :number

Source:

A globally unique object to reference when you want to delete things from state.

Type:
  • number
Examples
// `deleted` is essentially just a Symbol, but works in IE.
const deleted = new Number(0);
deleted === 0; // false
deleted === deleted; // true
import { Store, deleted } from "simple-shared-state";

const actions = () => ({
  removeB: (prop) => ({
    [prop]: deleted,
  }),
});
const store = new Store({ a: 1, b: 2 }, actions);
console.log(store.getState()); // { a: 1, b: 2 }

store.actions.removeB("b");

// state: { a: 1 }