Created
August 4, 2024 11:05
-
-
Save gaeng2y/55afbec6deaee2ed190cc7221be1dfb9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func todoReducer(state: [String], action: Action) -> [String] { | |
| var newState = state | |
| switch action { | |
| case .addTodoItem(let text): | |
| newState.append(text) | |
| case .removeTodoItem(let index): | |
| newState.remove(at: index) | |
| } | |
| return newState | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment