rexa
v0.1.1
Published
redux reducer library for clean http calls
Downloads
9
Readme
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());