1.0.0 • Published 8 years ago
redux-generator-thunk v1.0.0
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
1.0.0
8 years ago