investtools / extensible-duck

Modular and Extensible Redux Reducer Bundles (ducks-modular-redux)
MIT License
147 stars 12 forks source link

redux-thunk support #8

Closed MillerGregor closed 7 years ago

MillerGregor commented 7 years ago

It works, which is great, so it might be worth adding to the README:

A Duck's action creators can be normal plain objects or thunks (see: redux-thunk)

    creators: (duck) => ({
        logout:             () => ({ type: duck.types.LOGOUT }),
        removeTokenAsync:   () => {
                return dispatch => {
                    return StorageAsync.removeItem(tokenKey)
                    .then(() => (dispatch({ type: duck.types.REMOVE_TOKEN })));
                }
        }
    })
akelmanson commented 7 years ago

Done! Sorry for the delay.

https://github.com/investtools/extensible-duck#defining-the-creators