redux-actions
Search…
Read Me

Looking for Maintainers

Unfortunately I (timche) don't have the required time anymore to maintain this library and give it the necessary attention. Therefore I'm looking for maintainers that are willing to take care of this library on a long-term basis.
Requirements:
    Having knowledge of this library and open-source in general.
    Keeping the philosophy and goals of this library.
    Taking care of issues and pull requests.
    If required and reasonable, working out next versions of this library with the intention to improve it with the community in mind and not for the sole purpose.
    Knowing what's good for the library and what not (e.g. not accepting every suggestion) in order to maintain the library scope.
    Having knowledge about the tooling (CI, build system, etc.) and the docs and maintaining them.
It's also possible to join redux-utilities, an umbrella organization of complementing redux utility libraries like this one, to take care of few or all libraries. Please let me know if you are interested in that.
Please send me an email (adress on my profile) with the subject "redux-actions" and some information about you, if you want to be a maintainer.

redux-actions

Flux Standard Action utilities for Redux

Table of Contents

Getting Started

Installation

1
$ npm install --save redux-actions
Copied!
or
1
$ yarn add redux-actions
Copied!
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

1
import { createActions, handleActions, combineActions } from 'redux-actions';
2
3
const defaultState = { counter: 10 };
4
5
const { increment, decrement } = createActions({
6
INCREMENT: (amount = 1) => ({ amount }),
7
DECREMENT: (amount = 1) => ({ amount: -amount })
8
});
9
10
const reducer = handleActions(
11
{
12
[combineActions(increment, decrement)]: (
13
state,
14
{ payload: { amount } }
15
) => {
16
return { ...state, counter: state.counter + amount };
17
}
18
},
19
defaultState
20
);
21
22
export default reducer;
Copied!

Documentation

Last modified 1yr ago