Skip to content

Instantly share code, notes, and snippets.

@mcjcloud
Created July 10, 2020 06:41
Show Gist options
  • Save mcjcloud/c546c3b0d4ec78dd85263edba13af61b to your computer and use it in GitHub Desktop.
Save mcjcloud/c546c3b0d4ec78dd85263edba13af61b to your computer and use it in GitHub Desktop.
Asterisk Medium Article: todo component actions
/**
* 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