Skip to content

Higher-order Redux reducer which returns payload for specific actions

License

Notifications You must be signed in to change notification settings

CyberInt/redux-payload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

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.

About

Higher-order Redux reducer which returns payload for specific actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •