You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a "Currency" reducer that is constructed with a table of action handlers
The problem is that there are different types of actions that can be dispatched which affect currency. So I have to type them in the action handler itself in order to disambiguate the action type that is being handled. In this example, an "AddCurrencyAction" stores a "Delta" value to be added to the currency, whereas a "SetCurrencyAction" stores a "Currency" value to overwrite the currency.
This is not allowed however, because createReducer wants all actions handlers to handle the same type of action.
My solution was to overload createReducer to generalize an action to an "any" type, with the assumption that I will be specifying the action type myself.
The text was updated successfully, but these errors were encountered:
I have a "Currency" reducer that is constructed with a table of action handlers
The problem is that there are different types of actions that can be dispatched which affect currency. So I have to type them in the action handler itself in order to disambiguate the action type that is being handled. In this example, an "AddCurrencyAction" stores a "Delta" value to be added to the currency, whereas a "SetCurrencyAction" stores a "Currency" value to overwrite the currency.
This is not allowed however, because createReducer wants all actions handlers to handle the same type of action.
My solution was to overload createReducer to generalize an action to an "any" type, with the assumption that I will be specifying the action type myself.
The text was updated successfully, but these errors were encountered: