Flux Standard Action utilities for Redux.
Flux Standard Action utilities for Redux
$ npm install --save redux-actionsor
$ yarn add redux-actionsThe npm package provides ES modules that should be compatible with every modern build tooling.
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.
Not working with Jest from v3.0.0 part 2
3.0.3 release comes without src folder
Compilation error in `react-native:0.71.8`
Not Working with React Native from v.3.0.0
can redux-actions be used with redux-thunk?
Add support for uppercased action type name in createActions returned action map?
[Feature request] Function value for defaultState
can't use Map on handleActions
Error handling on action payload
Use immer within redux-actions