-
Notifications
You must be signed in to change notification settings - Fork 296
fallthrough actions #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
have you checked |
Yep, please see https://github.com/acdlite/redux-actions/#combineactionsactiontypes. Thanks @xiaohanzhang. |
Yes, I did see |
This is how we usually use it in code: handleActions({
[
combineActions(
FETCH_ERROR,
CREATE_ERROR,
EDIT_ERROR,
DELETE_ERROR
)
]: (state, { payload }) => state
.set('phase', ERROR)
.set('error', String(payload.error));
}, {}); |
That one is briljant. Can't believe it's not that obviously noted in the readme. |
@smeijer Would you mind submitting a PR to improve the README? |
Actually, this is taken care of in https://github.com/acdlite/redux-actions/pull/165/files. |
Uh oh!
There was an error while loading. Please reload this page.
In normal reducers we can use fallthrough to use the same reducing method for multiple action types. What's the easy way to do this in
redux-actions
?Is this even possible?
I realize I can create a small helper function, and call this function 4 times, but still it doesn't look very nice:
Anyone with suggestions to handle this in a clean way?
The text was updated successfully, but these errors were encountered: