Created
July 10, 2020 06:41
-
-
Save mcjcloud/c546c3b0d4ec78dd85263edba13af61b to your computer and use it in GitHub Desktop.
Asterisk Medium Article: todo component actions
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
/** | |
* make a request to add a todo item | |
*/ | |
const addTodo = (): void => { | |
dispatch(createTodo({ | |
label: `Todo ${[...completeTodos, ...incompleteTodos].length}`, | |
})) | |
} | |
/** | |
* make a request to mark a to-do item as complete | |
*/ | |
const checkTodo = (todo: TodoItem): void => { | |
if (!todo._id) { | |
return | |
} | |
dispatch(completeTodo(todo._id)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment