1.7.0 • Published 5 years ago

redux-action-helper-x v1.7.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

redux-action-helper-x

Travis (.org) Coveralls github David GitHub code size in bytes npm NPM

This package includes helper functions to reduce the redux boilerplate for action types and actions.

Install

npm i redux-action-helper-x

yarn add redux-action-helper-x

Helper Functions

This library offers two helper function: createRoutine and createSingleAction.

createRoutine

This helper function is mainly for REQUEST/SUCCESS/FAILURE redux action calls. It will create three action types automatically and create three action functions including the payload.

Example:

// todo.actions.js
import { createRoutine } from "redux-action-helper-x";

export const todoAddRoutine = createRoutine("todo/ADD");
// todo.reducer.js
import { todoAddRoutine } from "./todo.actions.js";

export default (state = {}, action) => {
  switch (action.type) {
    case todoAddRoutine.request:  return {};
    case todoAddRoutine.success:  return {};
    case todoAddRoutine.failure:  return {};
    default:  return state;
  }
}
1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago