redux-generator-thunk
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Redux Generator Thunk

Generator thunk middleware for Redux.

npm version npm downloads

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

/redux-generator-thunk/

    Package Sidebar

    Install

    npm i redux-generator-thunk

    Weekly Downloads

    36

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • danbahrami-geckoboard
    • geckoboard-matt
    • geckoboard-devs