We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b9c9cd commit 60b4259Copy full SHA for 60b4259
src/features/counter/counterReducer.ts
@@ -0,0 +1,17 @@
1
+import { INCREMENT_COUNTER, DECREMENT_COUNTER } from './actionTypes'
2
+import { CounterActionTypes } from './types'
3
+
4
+const initialState = {
5
+ value: 0,
6
+}
7
8
+export default (state = initialState, action: CounterActionTypes) => {
9
+ switch (action.type) {
10
+ case INCREMENT_COUNTER:
11
+ return { ...state, value: state.value + 1 }
12
+ case DECREMENT_COUNTER:
13
+ return { ...state, value: state.value - 1 }
14
+ default:
15
+ return state
16
+ }
17
0 commit comments