4 ms·
Could you then do the case statements in the reducer like this? switch (action.type) { case IncrementCounterAction.type: return state.update(..
by WayneBro 10y ago
Could you then do the case statements in the reducer like this?
switch (action.type) {
case IncrementCounterAction.type:
return state.update(...);
case DeccrementCounterAction.type:
return state.update(...);
....
}
- lylepstein 10y agoI believe you can, though I haven't tried it. Typescript will actually give you completion support for plain strings inside that switch statement, which is normally what I go with.