petiole-seamless-immutable

0.3.2 • Public • Published

petiole-seamless-immutable

Wraps state in Petiole store automatically to immutable data structures which are backwards-compatible with normal JS Arrays and Objects.

See rtfeldman/seamless-immutable for API details.

Usage

npm install petiole-seamless-immutable --save

import petiole from 'petiole';
import immutable from 'petiole-seamless-immutable';
 
const { declareLeaf, createStore } = petiole(immutable);
 
const numbers = declareLeaf({
  initialState: {
    list: [0, 1, 2],
  },
});
const store = createStore({ numbers });
const state = store.getState();
 
state.numbers.list.push(3); // throws ImmutableError

Package Sidebar

Install

npm i petiole-seamless-immutable

Weekly Downloads

1

Version

0.3.2

License

MIT

Last publish

Collaborators

  • ilkkahanninen