0.1.1 • Published 7 years ago

rexa v0.1.1

Weekly downloads
9
License
-
Repository
-
Last release
7 years ago

rexa

redux reducer library for clean http calls

import * as Imm from "immutable";
import { reducer } from "rexa";

const INITIAL_STATE = Imm.fromJS({
    count: 0  
});

export default reducer(INITIAL_STATE, (state, action, rexa) => {
   rexa.on("INCREMENT", data => state.set("count", state.get("count") + data.amount));
   rexa.on("DECREMENT", data => state.set("count", state.get("count") - data.amount));
   
   rexa.get("CURRENT_COUNT", {
        pending: data => {},
        success: data => {},
        failure: data => {}   
   });
});
import * as api from "./api";
import { get } from "rexa";

export const getCurrentCount = () => get("CURRENT_COUNT", api.getCurrentCount());