diff --git a/src/components/Home/Home.jsx b/src/components/Home/Home.jsx index 6b1702b..acad1e2 100644 --- a/src/components/Home/Home.jsx +++ b/src/components/Home/Home.jsx @@ -30,23 +30,21 @@ const Home = () => { } function updateTitle(updatedId, updatedTitle) { - const update = tasks.map(item => { - if (item.id === updatedId) { - item.title = updatedTitle; - } - return item; - }); - updateTasks(update); + const index = tasks.findIndex(item => item.id === updatedId); + if (index !== -1) { + const update = [...tasks]; + update[index].title = updatedTitle; + updateTasks(update); + } } function updateStatus(updatedId, status) { - const update = tasks.map(item => { - if (item.id === updatedId) { - item.completed = status; - } - return item; - }); - updateTasks(update); + const index = tasks.findIndex(item => item.id === updatedId); + if (index !== -1) { + const update = [...tasks]; + update[index].completed = status; + updateTasks(update); + } } return (