I am having a really weird issue with my To Do list app. When you delete one TODO from the list it is deleting all of them. this is the code
const deleteTask = (id) => {
fetch(http://localhost:8088/tasks/${id}, {
method: "DELETE",
headers: {
"Content-Type": "application/json"
}
})
.then(fetchTasks)
}
onClick={() => {deleteTask(task.id)}}
All other features of a task item work appropriately but when I press this onClick and run the fetch call it deletes all tasks by the current user. In my network tab the fetch only shows to be running once using the proper ID.
are you updating the UI with the fetchTasks after you removing the specific task or when do you do that ?