Giter Club home page Giter Club logo

ignite-project-todolist's Introduction

project-01

This is a project created using the concepts learned in Rocketseat's classes in the Ignite program for a To Do List.

Design

This Front-end project was developed based on the design proposed in Figma.

Technologies

This project was developed using Vite + ReactJS, Typescript.

The project dependencies were:

"dependencies": {
   "@phosphor-icons/react": "^2.0.10",
   "@types/uuid": "^9.0.2",
   "classnames": "^2.3.2",
   "react": "^18.2.0",
   "react-dom": "^18.2.0",
   "uuid": "^9.0.0"
},
"devDependencies": {
   "@types/react": "^18.2.15",
   "@types/react-dom": "^18.2.7",
   "@typescript-eslint/eslint-plugin": "^6.0.0",
   "@typescript-eslint/parser": "^6.0.0",
   "@vitejs/plugin-react": "^4.0.3",
   "eslint": "^8.45.0",
   "eslint-plugin-react-hooks": "^4.6.0",
   "eslint-plugin-react-refresh": "^0.4.3",
   "typescript": "^5.0.2",
   "vite": "^4.4.5"
}

Run Project

Run the installation of dependencies with:

npm i

Run the exe project using the command:

npm run dev

๐Ÿ˜ Enjoy!!

What I Learned with This Project?

Too many props

With this project I learned that there were components that I had to use props a lot. I had difficulty communicating between elements and in a future class I saw that this can be improved using contexts in React.

...
<CreateTask
   newTaskContent={newTaskContent}
   handleNewTaskChange={handleNewTaskChange}
   handleCreateNewTask={handleCreateNewTask}
   handleNewTaskInvalid={handleNewTaskInvalid}
/>
<ListTask
   tasks={tasks} 
   onDeleteTask={onDeleteTask}
   onChangeChecked={onChangeChecked}
/>
...

References and Value in Javascript

During development I learned that I have to copy the list, because if I point a variable directly to another I would have problems because I am passing the list pointer.

function onChangeChecked(taskToChange:Task){
   const taskIndex = tasks.findIndex(task => task.id === taskToChange.id)
   let newTasks = task // <---- Problema Here
   newTasks[taskIndex].isComplete = !newTasks[taskIndex].isComplete
   setTasks(newTasks)
}

The correct way is to create a new list.

function onChangeChecked(taskToChange:Task){
   const taskIndex = tasks.findIndex(task => task.id === taskToChange.id)
   let newTasks = [...tasks] // <---- Correct
   newTasks[taskIndex].isComplete = !newTasks[taskIndex].isComplete
   setTasks(newTasks)
}

Design Limite Screen

I learned about how to make the design more responsive using @media. With it I can change classes in CSS based on a specific size.

@media (max-width: 768px) {
   .createTask input[type=text]{
      width: 100%;
   }
   .createTask{
      display: block;
   }
   .createTask button[type=submit]{
      margin-top: 0.5rem;
      width: 100%;
   }
}

Acknowledgment

Thanks to Rocketseat for the content and initiatives it provides.๐Ÿš€

ignite-project-todolist's People

Contributors

matheus1714 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.