1.2.0 • Published 8 years ago

redux-caller v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

Version Build Status MIT license dependencies devDependency Status airbnb code style


Peer Dependencies

Getting Started

npm install redux-caller --save

Usage

import { Record } from 'immutable';
import { createStore } from 'redux'
import { createReducer } from 'redux-caller';

const ACTIONS = {
  SET_COUNT: 'COUNTER_STORE__SET_COUNT'
};

class CounterStore extends Record({count: 1}) {
  handleAction({type, payload}) {
    switch (type) {
      case ACTIONS.SET_COUNT:
        return this.set('count', payload);
      default:
        return this;
    }
  }
}

let store = createStore(createReducer(new CounterStore()));

store.dispatch({ type: ACTIONS.SET_COUNT, payload: 2 }) // => CounterStore { count = 2 }

store.dispatch({ type: ACTIONS.SET_COUNT, payload: 20 }) // => CounterStore { count = 20 }

store.dispatch({ type: ACTIONS.SET_COUNT, payload: 1 }) // => CounterStore { count = 1 }

Credits

License

MIT @ Joe Delgado

1.2.0

8 years ago

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago