Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Personal code review #5

Open
2 tasks
mershark opened this issue Jul 17, 2023 · 0 comments
Open
2 tasks

Personal code review #5

mershark opened this issue Jul 17, 2023 · 0 comments

Comments

@mershark
Copy link
Owner

You have done a great job so far keep it up, so far there are no errors that I have found in your code, but some suggestion to make your project more user friendly

Highlights

  • JavaScript best practices ✅
  • DRY, KISS, and YAGNI ✅
  • HTML and CSS best practices ✅

Suggestions

  • In the addIcon event listener in your index.js file, you could add some validation to ensure that the description input is not empty before adding a new task. This can prevent the creation of empty tasks and improve the user experience.

    To-do-list/src/index.js

    Lines 102 to 112 in 55e8599

    const addIcon = document.getElementById('add-icon');
    addIcon.addEventListener('click', () => {
    const taskInput = document.getElementById('task-input');
    const description = taskInput.value.trim();
    if (description) {
    tasks = addTask(tasks, description);
    taskInput.value = '';
    updateLocalStorage();
    renderTasks(tasks);
    }
    });

  • In the refreshTasks function, you could add a check to ensure that the stored tasks are not already equal to the tasks array before rendering the tasks. This can prevent unnecessary rendering and improve performance.

    To-do-list/src/index.js

    Lines 89 to 96 in 55e8599

    const refreshTasks = () => {
    const storedTasks = localStorage.getItem('tasks');
    if (storedTasks) {
    tasks = JSON.parse(storedTasks);
    renderTasks(tasks);
    }
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant