0.1.5 • Published 8 years ago
redux-payload v0.1.5
redux-payload
Higher-order Redux reducer which returns payload for specific actions
Usage
Install via NPM
npm install redux-payload --save
Import
import payload from 'redux-payload';
// or
var payload = require('redux-payload');
If you need ES6 module
import payload from 'redux-payload/es6';
Use this if you are using rollup.js or webpack 2, or any ES2015 modules-compatible bundler which can eliminate unused library code with tree-shaking.
It is recommended to import the library from redux-payload/es6
instead of
redux-payload/src
because the source code depends on experimental presets from
babel (stage 1-3) and may be incompatible with your bundler or settings.
Other environments
Use the Universal Module Definition (UMD)
- payload.js
- payload.min.js (minified)
API
payload(
actionType: String,
mapResult: ?(resultBefore: any) => resultAfter
): (reducer) => reducer
Creates a higher-order reducer which returns the payload of the action
for the given action type. Before returning it maps the payload with mapResult
function, which is useful when you deal with immutable data structures in your store.