MCPcopy
hub / github.com/reduxjs/redux / reducer0

Function reducer0

test/typescript/reducers.ts:93–114  ·  view source on GitHub ↗
(state = 0, action)

Source from the content-addressed store, hash-verified

91 type MyAction1 = MultiplyAction | DivideAction
92
93 const reducer0: Reducer<State, MyAction0> = (state = 0, action) => {
94 if (action.type === 'INCREMENT') {
95 // Action shape is determined by `type` discriminator.
96 // @ts-expect-error
97 action.wrongField
98
99 const { count = 1 } = action
100
101 return state + count
102 }
103
104 if (action.type === 'DECREMENT') {
105 // @ts-expect-error
106 action.wrongField
107
108 const { count = 1 } = action
109
110 return state - count
111 }
112
113 return state
114 }
115
116 const reducer1: Reducer<State, MyAction1> = (state = 0, action) => {
117 if (action.type === 'MULTIPLY') {

Callers 1

discriminatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected