This effect is used when describing the SUCCESS case of the SUCCESS-FAILURE pattern.
This effect is a multi-target effect - It modifies more than one target at the same time.
It will:
- Put
${action.target}Loadinginfalse - Put
${action.target}Errorinnull - Fill
${action.target}with youraction.payloadby default, or use a selector provided - Put
${action.target}IsRetryinginfalseifaction.isPollingis truthy - Put
${action.target}CountRetryin0ifaction.isPollingis truthy
Example:
const selector =
(action, state) => action.payload || state[action.target];
const reducerDescription = {
'SUCCESS': onSuccess(),
'SUCCESS_CUSTOM': onSuccess(selector)
}; onSuccess effect receives an optional parameter:
- selector: This function describes how we read the data from the
action.
(action, state) => any
By default, is:
action => action.payload