react-scan
react-scan copied to clipboard
fix: add unique identifiers to tasks for accurate deletion
Summary
This pull request addresses an issue where tasks with the same text could not be accurately deleted due to the lack of unique identifiers. By assigning a unique id
to each task, we ensure that tasks can be correctly identified and managed.
Changes Made
-
AddTaskBar Component: Modified to assign a unique
id
to each task usingDate.now()
. -
TaskList and TaskItem Components: Updated to handle tasks with unique
id
s, ensuring accurate deletion. -
State Management: Updated the
tasks
state to be an array of objects, each containing anid
andtext
.
Why This Change?
Previously, tasks were identified by their text value, leading to conflicts when tasks with the same text were added. This change ensures that each task has a unique identifier, allowing for accurate management and deletion of tasks.
How to Test
- Add multiple tasks with the same text.
- Delete tasks and verify that the correct task is removed.
- Ensure that the task list updates correctly after deletion.
Related Issue
Fixes #61