redux-generator-thunk
v1.0.0
Published
Generator based thunk middleware for Redux.
Downloads
2
Readme
Redux Generator Thunk
Generator thunk middleware for Redux.
npm install --save redux-generator-thunk
Motivation
Redux Generator Thunk middleware allows you to write action creators that return a generator function instead of an action. The generator function receives getState
as a parameter.
Examples
An action creator that performs an async action:
const INCREMENT_COUNTER = 'INCREMENT_COUNTER';
const increment = () => {
return {
type: INCREMENT_COUNTER
};
};
const incrementAsync = () => {
return function* () {
yield delay(1000);
yield increment();
};
}
License
MIT