0.3.2 • Published 9 years ago

petiole-seamless-immutable v0.3.2

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

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