Skip to content

[AIBE6/5팀/성철제] TODO APP 만들기 완료#46

Open
scj0325 wants to merge 5 commits intosik2:mainfrom
scj0325:main
Open

[AIBE6/5팀/성철제] TODO APP 만들기 완료#46
scj0325 wants to merge 5 commits intosik2:mainfrom
scj0325:main

Conversation

@scj0325
Copy link

@scj0325 scj0325 commented Mar 18, 2026

이 과제는 React를사용해 간단한 Todo List를 구현하는 프로젝트입니다.

컴포넌트 구조와 상태 관리를 이해하고,

할 일을 입력하면 목록에 추가되고, 삭제할 수 있으며, 체크버튼으로 true false 확인

기능 요약
할 일 추가
할 일을 입력하고 'Add' 버튼으로 새 할 일 생성
할 일 삭제
할 일 항목의 'Delete' 버튼으로 목록에서 삭제
완료 체크/해제
체크박스 클릭으로 할 일 완료/미완료 상태 전환
(완료 시 텍스트에 취소선 표시)

스크린샷
image

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 React와 Vite를 사용하여 TODO 애플리케이션의 초기 개발 환경을 설정하고, 핵심 기능을 구현합니다. 여기에는 프로젝트의 기본 파일 구조, 의존성 관리, ESLint 설정, 그리고 TODO 항목을 추가, 삭제, 토글할 수 있는 기본적인 UI 컴포넌트 및 상태 관리 로직이 포함됩니다.

Highlights

  • 프로젝트 초기 설정: React와 Vite를 사용하여 TODO 애플리케이션의 초기 개발 환경이 설정되었습니다.
  • TODO 애플리케이션 기본 기능 구현: TODO 항목을 추가, 삭제, 토글할 수 있는 기본적인 UI 컴포넌트(ToDoWriteForm, ListForm)가 구현되었습니다.
  • React Context API 도입: 애플리케이션 전반의 TODO 상태 관리를 위해 React Context API(TodoContext)가 도입되었습니다.
  • ESLint 설정 추가: 코드 품질 및 일관성 유지를 위한 ESLint 설정이 프로젝트에 추가되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request initializes a new React project using Vite, setting up ESLint and implementing a basic Todo application with React Context for state management. Key changes include adding standard project files like .gitignore, package.json, index.html, and src/App.css, along with core React components (App.jsx, ListForm.jsx, ToDoWriteForm.jsx) and a TodoContext.jsx for global state. Review comments highlight several critical issues and improvement opportunities: a merge conflict in README.md needs resolution; the ToggleE function in TodoContext.jsx directly mutates state and misuses filter, requiring a refactor to use map for immutability; there are numerous unnecessary imports and large blocks of commented-out code across App.jsx, ListForm.jsx, ToDoWriteForm.jsx, and TodoContext.jsx that should be removed for clarity; a redundant src/hooks/useContext.js file with a name conflicting with React's built-in hook should be deleted; lastid is imported but unused in ListForm.jsx; index is incorrectly used as a key in ListForm.jsx's map function, which should be replaced with todo.id; and the removeTodo function in TodoContext.jsx has a misleading parameter name (sindex instead of id) and unclear callback arguments (ab, cb).

Comment on lines +1 to +20
<<<<<<< HEAD
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## React Compiler

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).

## Expanding the ESLint configuration

If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
=======
# 리액트 투두 앱 만들기 미션 레포
>>>>>>> 23993ab9d9dd5f873ce4a2795af61a2fdb1f6866

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

README.md 파일에 병합 충돌(merge conflict)이 있습니다. <<<<<<< HEAD, =======, >>>>>>> 표시를 제거하고 파일 내용을 올바르게 정리해주세요.

Comment on lines +28 to +37
const ToggleE = (ina) => {
//const filterToggle = todos.filter((ab, cd) => isBigEnough(ab.id, ina, ab));
const filterToggle = todos.filter(
(ab, cd) =>
(ab.id == ina
? (ab.checked = !ab.checked)
: (ab.checked = ab.checked)) || true,
);
setTodos(filterToggle);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

ToggleE 함수에서 React 상태를 직접 변경(mutate)하고 있으며, filter 메소드를 잘못 사용하고 있습니다.

  1. 상태 불변성 위반: ab.checked = !ab.checked와 같이 상태 객체를 직접 수정하면 안 됩니다. React에서 상태는 불변(immutable)으로 다루어야 합니다.
  2. filter 메소드 오용: filter는 특정 조건에 맞는 요소만 모아 새로운 배열을 만드는 함수입니다. 여기서는 배열 요소를 수정하는 용도로 사용되었고, || true 때문에 실제 필터링은 일어나지 않습니다. 상태 업데이트에는 map을 사용하는 것이 올바른 방법입니다.

아래와 같이 map을 사용하여 새로운 배열을 생성하고, 상태를 업데이트하는 방식으로 수정하는 것을 권장합니다.

  const ToggleE = (id) => {
    setTodos(
      todos.map((todo) =>
        todo.id === id ? { ...todo, checked: !todo.checked } : todo,
      ),
    );
  };

@@ -0,0 +1,51 @@
import "./App.css";
import "./components/ToDoWriteForm.jsx";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

import "./components/ToDoWriteForm.jsx";는 불필요한 import 입니다. 바로 아래 줄에서 ToDoWriteForm 컴포넌트를 정상적으로 import하고 있으므로, 이 줄은 side effect를 위한 import로 보이지만 실제로는 아무런 역할을 하지 않으며 혼란을 줄 수 있습니다. 제거하는 것이 좋습니다.

Comment on lines +7 to +42
// const { todos, lastid, addtodo, removeTodo, ToggleE } = useContext();
/* const [todoId, setTodoId] = useState(4);
const lastid = useRef(4);

const [todos, setTodos] = useState([
{ id: 3, text: "공부하기", checked: false },
{ id: 2, text: "저녁먹기", checked: false },
{ id: 1, text: "야구보기", checked: true },
]);
*/
/*function isBigEnough(cd, ina, ab) {
cd == ina ? (ab.checked = !ab.checked) : (ab.checked = ab.checked);
return true;
}*/
/* const handleOnSubmit = (e) => {
e.preventDefault();
const form = e.target;
return form.target.value;
};*/
/* const addtodo = (text) => {
setTodos([{ id: lastid.current++, text, checked: false }, ...todos]);
};
const removeTodo = (sindex) => {
const filterTodos = todos.filter((ab, cb) => ab.id != sindex);
setTodos(filterTodos);
};
const ToggleE = (ina) => {
//const filterToggle = todos.filter((ab, cd) => isBigEnough(ab.id, ina, ab));
const filterToggle = todos.filter(
(ab, cd) =>
(ab.id == ina
? (ab.checked = !ab.checked)
: (ab.checked = ab.checked)) || true,
);
setTodos(filterToggle);
};*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

사용하지 않는 주석 처리된 코드가 많이 남아있습니다. 코드 가독성을 위해 이 코드들을 제거하는 것이 좋습니다.

Comment on lines +12 to +20
/*function isBigEnough(cd, ina, ab) {
cd == ina ? (ab.checked = !ab.checked) : (ab.checked = ab.checked);
return true;
}*/
/* const handleOnSubmit = (e) => {
e.preventDefault();
const form = e.target;
return form.target.value;
};*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

사용하지 않는 주석 처리된 코드가 남아있습니다. 코드 가독성을 위해 제거해주세요.

import { useTodos } from "../context/TodoContext.jsx";

function ListForm() {
const { todos, lastid, removeTodo, ToggleE } = useTodos();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

useTodos로부터 lastid를 가져오지만 컴포넌트 내에서 사용하지 않습니다. 불필요한 변수는 제거하는 것이 좋습니다.

Suggested change
const { todos, lastid, removeTodo, ToggleE } = useTodos();
const { todos, removeTodo, ToggleE } = useTodos();

<>
<ul>
{todos.map((todo, index) => (
<li key={index}>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

map 함수에서 keyindex를 사용하고 있습니다. 리스트의 순서가 바뀌거나 아이템이 추가/삭제될 때 indexkey로 사용하면 예기치 않은 동작이나 성능 저하가 발생할 수 있습니다. 각 todo 아이템은 고유한 id를 가지고 있으므로 key={todo.id}를 사용하는 것이 좋습니다.

Suggested change
<li key={index}>
<li key={todo.id}>

Comment on lines +16 to +18
{todo.checked.toString()}
{todo.id}
{todo.text}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

{todo.checked.toString()}, {todo.id}, {todo.text}는 디버깅 목적으로 추가된 것으로 보입니다. 최종 코드에서는 UI를 깔끔하게 정리하기 위해 제거하고, 텍스트만 남겨두는 것이 좋습니다.

Suggested change
{todo.checked.toString()}
{todo.id}
{todo.text}
{todo.text}

@@ -0,0 +1,22 @@
import "../App.jsx";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

import "../App.jsx";는 불필요한 import 입니다. App.jsx는 컴포넌트이며, 여기서 side effect(예: CSS import)를 위해 가져오는 것은 좋은 패턴이 아닙니다. 필요한 CSS가 있다면 직접 import 하거나, 이미 상위 컴포넌트에서 import 되고 있으므로 이 줄을 제거해도 무방합니다.

Comment on lines +24 to +27
const removeTodo = (sindex) => {
const filterTodos = todos.filter((ab, cb) => ab.id != sindex);
setTodos(filterTodos);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

removeTodo 함수의 파라미터 이름이 sindex로 되어있지만, 실제로는 id와 비교하고 있습니다. 혼동을 피하기 위해 id로 변경하는 것이 좋습니다. 또한, filter의 콜백 함수 인자 ab, cb는 의미를 알기 어렵습니다. todo와 같이 명확한 이름으로 변경하면 가독성이 향상됩니다.

Suggested change
const removeTodo = (sindex) => {
const filterTodos = todos.filter((ab, cb) => ab.id != sindex);
setTodos(filterTodos);
};
const removeTodo = (id) => {
const filterTodos = todos.filter((todo) => todo.id !== id);
setTodos(filterTodos);
};

@scj0325 scj0325 changed the title [AIBE6/5팀/성철제] TODO APP 만들기 진행중 #45 [AIBE6/5팀/성철제] TODO APP 만들기 완료 Mar 19, 2026
@@ -0,0 +1,38 @@
import { useState, useRef } from "react";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어려운 부분이었는데 잘 구현하신것 같아요.

@Tesalriah
Copy link

기본적인 Todo 기능들이 잘 구현되어 있어서 React 상태 관리 흐름을 이해하는 데에 적절한 프로젝트라고 느꼈습니다

할 일 추가, 삭제, 완료 체크/해제까지 핵심 기능이 빠짐없이 동작하고 있고체크 상태에 따라 취소선을 적용한 부분도 사용자 입장에서 직관적으로 잘 표현된 것 같습니다.

다만 몇 가지 개선해보면 더 좋을 것 같다고 느낀 부분입니다
현재 CSS가 적용되지 않은 상태라 UI 가독성이 조금 아쉬운데 간단한 스타일링만 추가해도 완성도가 훨씬 높아질 것 같습니다.

전체적으로 React의 기본 개념(useState, 이벤트 처리 등)을 잘 활용한 깔끔한 구현이라고 생각합니다.
기초를 잘 잡으신 만큼 이후에 스타일링이나 기능 확장까지 이어가시면 더 좋은 결과물이 될 것 같습니다!

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

Successfully merging this pull request may close these issues.

3 participants