Skip to content

Peer-to-Peer Code Review #4

Description

@Maedea9

Team's suggestions ♻️

@Ruthmy: Hi Adeyemi! I couldn't find what was going wrong during the execution of Completed Tasks. But maybe it would help if you add a data-index attribute to the tasks when they are created in the todoList. Something similar to this:
checkbox.setAttribute('data-index', task.index);

Then you can add an event listener that listens for changes in the checkbox and captures the data-index of the checkbox that has changed. Here's an example code that might better illustrate this idea:

javascript
Copy code
checkbox.addEventListener('change', (event) => {
const index = event.target.dataset.index - 1;
tasksArray[index].completed = event.target.checked;
localStorage.setItem('tasks', JSON.stringify(taskArray));
});

@Maedea9: Great job working on your to Do List, to fix your checked boxes in localStorage you could try loading the state of the checkbox from local storage with JSON.parse() and use and if statement to see if the checkbox status is true, then add an event listener to ('change') to update to completed and save that new data with localStorage.setItem. Then you might need to call the function that renders all the information back again to your page. Hope these suggestions helps! Keep up the good work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions