Open promontis opened 5 years ago
The method you outlined is how I'm doing it. However, if the empty method bothers you, I don't see why you couldn't create a normal action creator function and check for that action type in your saga and keep immer-reducer just for actions that mutate state.
Hi @epeli!
I was wondering how you implement Redux-Saga API calls.
If I take the default Redux-Saga readme example:
The pattern is to dispatch an action (
USER_FETCH_REQUESTED
) and handle it in the saga. The saga calls the API and puts the result to eitherUSER_FETCH_SUCCEEDED
orUSER_FETCH_FAILED
.Now when modeling this in immer-reducer would I get the following?
UserFetchRequested
UserFetchSucceeded
which would update the draftUserFetchFailed
which would update the draftSeems kinda weird... especially the empty method just for creating an action.
Would love to hear your view on this.
Thanks,
Michel