Skip to content

Instantly share code, notes, and snippets.

@ctrlplusb
Created November 5, 2018 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctrlplusb/604d8a2f24fa6195abff3e7df08c83f1 to your computer and use it in GitHub Desktop.
Save ctrlplusb/604d8a2f24fa6195abff3e7df08c83f1 to your computer and use it in GitHub Desktop.
import { createStore } from 'easy-peasy';
// Pass in your model and you get back a Redux store
const store = createStore(model);
// you can query state as normal
store.getState().todos.items;
// ['Install easy-peasy']
// and dispatch actions
store.dispatch.todos.add('Build an app')
// |---------|
// |- Actions are bound to a path matching model
// and access the other standard APIs of a Redux store
store.listen(() => console.log('An update occurred'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment