Ninety-nine Pitchers of Malt
    Wondering what’s next for npm?Check out our public roadmap! »

    @letapp/redux-actions

    3.0.1 • Public • Published

    redux-actions

    Build Status codecov npm npm

    Flux Standard Action utilities for Redux

    Table of Contents

    Getting Started

    Installation

    $ npm install --save @letapp/redux-actions

    or

    $ yarn add @letapp/redux-actions

    The npm package provides a CommonJS build for use in Node.js, and with bundlers like Webpack and Browserify. It also includes an ES modules build that works well with Rollup and Webpack2's tree-shaking.

    The UMD build exports a global called window.ReduxActions if you add it to your page via a <script> tag. We don’t recommend UMD builds for any serious application, as most of the libraries complementary to Redux are only available on npm.

    Usage

    import {
      createActions,
      handleActions,
      combineActions
    } from '@letapp/redux-actions';
     
    const defaultState = { counter: 10 };
     
    const { increment, decrement } = createActions({
      INCREMENT: (amount = 1) => ({ amount }),
      DECREMENT: (amount = 1) => ({ amount: -amount })
    });
     
    const reducer = handleActions(
      {
        [combineActions(increment, decrement)]: (
          state,
          { payload: { amount } }
        ) => {
          return { ...state, counter: state.counter + amount };
        }
      },
      defaultState
    );
     
    export default reducer;

    See the full API documentation.

    Documentation

    Install

    npm i @letapp/redux-actions

    DownloadsWeekly Downloads

    17

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    91.1 kB

    Total Files

    98

    Last publish

    Collaborators

    • avatar
    • avatar