Git Product home page Git Product logo

butkem-skilvul-task-tpa5-todo-app's Introduction

Bootcamp Skilvul FullStack TPA5 - Todo App

This is technical project assignment (TPA5) - Todo App ReactJs - Redux from the Skilvul Bootcamp Fullstack of the Innovation Women Program 2023.

Table of contents

Overview

Specs

  1. Create a Todo List application using React.js and state management Redux
  2. Users can add 1 new Todo List
  3. Users can see all Todo Lists (All) both active and completed
  4. Users can view/filter the Todo List with active status
  5. Users can view/filter the Todo List with completed status
  6. Users can delete Todo List
  7. Users can edit the Todo List

Scheme

  • The user was adding a todo, but the user changed his mind. User wants to edit todo / delete todo / view todo filter, automatically the process of adding todo is cancelled. This also applies to the todo editing process.

  • The user is editing a todo, the user deletes all the content, then clicks save, the todo editing process is automatically cancelled. This also applies to the process of adding todos

Screenshot

Design preview for the Todo-App

Links

My process

Built with

  • React Js
  • Redux
  • Tailwind

What I learned

The recaps noted here are basic things that I rarely use.

  • change useState to global state:
  // from this ...
  const [todo, setTodo] = useState('')
  const [isEditing, setIsEditing] = useState(false);
  const [editingTodoId, setEditingTodoId] = useState(null);
  const [editedTodoContent, setEditedTodoContent] = useState('');

  // to this ...
  editTodoId: null,
  editTodoContent: "",
  isEditing: false,
  inputTodoContent: "",
  isEmpty: false,
  • create click management (if I click on this, then it will ... ) :
// form this ... (without redux) 
  const deleteButton = (id) => {
    if (todo.trim() !== "") {
      // If the user is add todo, cancel add todo
      setTodo("");
    } else if (isEditing) {
      // If the user is editing, cancel editing
      setEditingTodoId(null);
      setIsEditing(false);
      setEditedTodoContent("");
    } else {
      // If the user is not editing, process delete todo
      dispatch(deleteTodo(id));
    }
  }

// to this ... (with redux)
  const deleteButton = (id) => {
    if (inputTodoContent.trim() !== "") {
      dispatch(cancelAdd())
    } else if (isEditing) {
      dispatch(cancelEdit())
    } else {
      dispatch(deleteTodo(id))
    }
  }
  • When using redux for simple applications, using global state is very helpful. I thought about adding PropTypes, but for a simple app like TodoApp, it's not necessary. The reason is, each component can be connected to each other by utilizing Redux's global status. However, that doesn't mean that PropTypes are useless, but they will be very useful for large-scale applications. Also keep in mind the functions of state and props are different, so this will be the reason when to use them to write clean and readable code.

Author

butkem-skilvul-task-tpa5-todo-app's People

Contributors

fidaatag avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.