Skip to content

slivcode/redux-typed-action-reducer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published