Todo Store

To write store we need to import Sinux in our project.

npm i sinux

todoStore.js

Store will be responsible to hold a scope of data for our application. In our case, the list of todos.

import { Store } from 'sinux';

const todoStore = new Store({todos:[]},
  'add',
  'remove',
  'update',
  'complete',
  'load',
);

export default todoStore;

The initial state of the store will be an object containing a property todos that is an empty array.

The store will expose signals to permit to add, remove, update and update the status of a Todo (complete). The load signal will be used to create dummy data in the store at lunch time.
(For more details see Store)

results matching ""

    No results matching ""