Skip to content

[AIBE3/4팀/안지협]Todo APP 만들기 완료#37

Open
TooTo3 wants to merge 1 commit intosik2:mainfrom
TooTo3:main
Open

[AIBE3/4팀/안지협]Todo APP 만들기 완료#37
TooTo3 wants to merge 1 commit intosik2:mainfrom
TooTo3:main

Conversation

@TooTo3
Copy link

@TooTo3 TooTo3 commented Jul 10, 2025

No description provided.

@TooTo3 TooTo3 changed the title Todo APP 만들기 완료 [AIBE3/4팀/안지협]Todo APP 만들기 완료 Jul 10, 2025
Copy link

@inti0 inti0 left a comment

Choose a reason for hiding this comment

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

아직 중간 피드백 단계입니다! todo앱의 로직 자체는 괜찮으니 localstorage 저장부분을 잘 고치면 제출 전까지 좋은 코드 완성할 수 있을 것 같습니다.

};
lastId.current++;
return todo;
};
Copy link

Choose a reason for hiding this comment

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

createTodo는 단순히 객체를 생성하는 함수인데 Id를 여기서 관리하는 것은 맞지 않을 것 같습니다.

import { getStorage, setStorage } from "../utils/storage";

function useTodos() {
const [todos, setTodos] = useState(() => getStorage("todos") || []); //useState 대신 Ref방식이 좋다
Copy link

Choose a reason for hiding this comment

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

상태관리가 필요할 땐 useState를 사용해야 한다고 생각합니다!


export function getStorage(key) {
return JSON.parse(localStorage.getItem(key));
}
Copy link

Choose a reason for hiding this comment

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

storage 파일이 미완성이라 todo앱의 기능이 정상작동하지 않는 것 같습니다 😢

Copy link

@dbjoung dbjoung left a comment

Choose a reason for hiding this comment

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

컴포넌트는 UI만, 그 외 로직은 대부분 useTodos에 들어있어서 깔끔하다고 느꼈습니다. 이해하기 쉬운 코드였던 것 같습니다. 많이 배웠습니다. 과제 수행 고생하셨습니다.

function App() {
const { todos, addTodo, toggleTodo, removeTodo } = useTodos();

const handleSubmit = (e) => {
Copy link

Choose a reason for hiding this comment

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

handleSumit도 useTodos에 넣으면 더 깔끔해질 것 같습니다.

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