If an action removeItem(itemId)
is fired from the UI it should first delete the corresponding item from the state and then call the associated saga. If the saga fails it should reset the state to it's original state.
I was wondering if you can append information to the action payload within the reducers then fire a failed
action from the saga with the same payload. This is assuming that the reducer will always be fired first (Is it true?)
You shouldn't dispatch from inside your reducer. A reducers job is to take current state, an action, and return new state from the reduction of the two. That's it. What you're trying to do can be accomplished by a strategy like the following:
itemId
to get a reference to the item and store it locally.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.