redux-typed-action-reducer
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Redux Typed Action Reducer

introduction

Typescript Redux Reducer Helper.

Example

import TypedReducer from 'redux-typed-action-reducer';
const ASwitch = TypedReducer<boolean>({ ns: 'switch', init: false })({
  set: (b:boolean) => orgState => b,
});

// => (type: 'switch', args: [true])
ASwitch.toggle(true);

// => 'switch::toggle' 
ASwitch.toggle['type'];

// => roughly
// (pr = false, {type, args}) => {
// const actions = {
//  toggle: (arg) => (org) => arg;
// } 
// if (actions[type]) return actions[type](...args)(pr);
// return pr;
// }
ASwitch.reducer

Package Sidebar

Install

npm i redux-typed-action-reducer

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • sliv