-
-
Save amandeepmittal/158ff3cb67bd5acf2994d102032bafc5 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
checkTodo = id => { | |
setTodos( | |
todos.map(todo => { | |
if (todo.key === id) todo.checked = !todo.checked; | |
return todo; | |
}) | |
); | |
}; | |
deleteTodo = id => { | |
setTodos( | |
todos.filter(todo => { | |
if (todo.key !== id) return true; | |
}) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment