2.0.0 • Published 9 years ago

redux-switch-action v2.0.0

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

Redux Switch Action

Slightly more concise reducer switching for Flux Standard Actions.

const switchAction = createSwitchAction({
  [ADD]: addReducer,
  [SUB]: subReducer,
});

export function reducer(state = 0, action) {
  return switchAction(state, action);
}

function addReducer(state, {payload}) {
  return state + payload.amount;
}

function subReducer(state, {payload}) {
  return state - payload.amount;
}
2.0.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.1

9 years ago