Created
February 22, 2024 23:47
-
-
Save antklim/a44f71142730bdac7e3c6ff53cb5df74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ReducerState = { | |
count: number; | |
}; | |
type ReducerAction = | |
| { | |
type: "add"; | |
add: number; | |
} | |
| { | |
type: "subtract"; | |
subtract: number; | |
}; | |
const reducer = (state: ReducerState, action: ReducerAction) => { | |
const reducer: Reducer<ReducerState, ReducerAction> = (state, action) => { | |
switch (action.type) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment