redux-actions

Flux Standard Action utlities for Redux

MIT 39 个版本
安装
npm install redux-actions
yarn add redux-actions
pnpm add redux-actions
bun add redux-actions
README

redux-actions

Build Status codecov npm npm

Flux Standard Action utilities for Redux

Table of Contents

Getting Started

Installation

$ npm install --save redux-actions

or

$ yarn add redux-actions

The npm package provides ES modules that should be compatible with every modern build tooling.

Usage

import { createActions, handleActions, combineActions } from '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

版本列表
3.0.3 2024-07-21
3.0.0 2023-02-12
2.6.5 2019-03-04
2.6.4 2018-11-02
2.6.3 2018-10-22
2.6.1 2018-07-26
2.6.0 2018-07-26
2.5.1 2018-07-25
2.5.0 2018-07-25
2.4.0 2018-05-27
2.3.2 2018-05-03
2.3.1 2018-05-03
2.3.0 2018-03-07
2.2.1 2017-07-03
2.2.0 2017-07-02
2.1.0 2017-07-01
2.0.3 2017-05-10
2.0.2 2017-04-16
2.0.1 2017-03-05
2.0.0 2017-03-04
1.2.2 2017-02-25
1.2.1 2017-01-26
1.2.0 2016-12-13
1.1.0 2016-11-23
1.0.1 2016-11-21
1.0.0 2016-11-18
0.13.0 2016-10-30
0.12.0 2016-09-01
0.11.0 2016-08-19
0.10.1 2016-07-09
0.10.0 2016-06-08
0.9.1 2016-01-19
0.9.0 2015-12-11
0.8.0-alpha 2015-07-16
0.8.0 2015-08-24
0.7.0 2015-07-13
0.6.0 2015-07-03
0.5.1 2015-07-03
0.5.0 2015-07-03