Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created June 15, 2021 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallmurphy/8e0b287f2f41f27153ea7f9784f581e1 to your computer and use it in GitHub Desktop.
Save marshallmurphy/8e0b287f2f41f27153ea7f9784f581e1 to your computer and use it in GitHub Desktop.
const removeTodo = (i, checked) => {
if (checked) {
const newCompletedTodos = [...completedTodos];
newCompletedTodos.splice(i, 1);
setCompletedTodos(newCompletedTodos);
} else {
const newTodos = [...todos];
newTodos.splice(i, 1);
setTodos(newTodos);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment