- Notifications
You must be signed in to change notification settings - Fork294
Flux Standard Action utilities for Redux.
License
NotificationsYou must be signed in to change notification settings
redux-utilities/redux-actions
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Flux Standard Action utilities for Redux
$ npm install --save redux-actions
or
$ yarn add redux-actionsThenpm package provides aCommonJS build for use in Node.js, and with bundlers likeWebpack andBrowserify. It also includes anES modules build that works well withRollup andWebpack2's tree-shaking.
TheUMD build exports a global calledwindow.ReduxActions if you add it to your page via a<script> tag. Wedon’t recommend UMD builds for any serious application, as most of the libraries complementary to Redux are only available onnpm.
import{createActions,handleActions,combineActions}from'redux-actions';constdefaultState={counter:10};const{ increment, decrement}=createActions({INCREMENT:(amount=1)=>({ amount}),DECREMENT:(amount=1)=>({amount:-amount})});constreducer=handleActions({[combineActions(increment,decrement)]:(state,{payload:{ amount}})=>{return{ ...state,counter:state.counter+amount};}},defaultState);exportdefaultreducer;
About
Flux Standard Action utilities for Redux.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.