...
github-icon
GitHub
6.49kstar-icon
Created 10 years ago, last commit a year ago
67 contributors
234 commits
Stars added on GitHub, month by month
0
0
8
9
10
11
12
1
2
3
4
5
6
7
2024
2025
Stars added on GitHub, per day, on average
Yesterday
=
Last week
0.0
star-icon /day
Last month
-0.1
star-icon /day
Last 12 months
-0.1
star-icon /day
npmPackage on NPM
Monthly downloads on NPM
8
9
10
11
12
1
2
3
4
5
6
7
2024
2025
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