삭제
const deleteHandler = (id) => {
let updatedWord = [...day1Wordlist].filter((word) => {
return word.id !== id;
});
setDay1Wordlist(updatedWord);
};
원하는것만 클릭해서 처리하기
function toggleComplete(id) {
const updatedTodos = [...todos].map((todo) => {
if (todo.id === id) {
return {
...todo, completed : !todo.completed
}
}
return todo;
});
setTodos(updatedTodos);
}
{todoEditing === todo.id ? null : (
<input
type="checkbox"
className="complete"
onChange={() => toggleComplete(todo.id)}
checked={todo.completed}
/>
)}