Open
Conversation
|
코드 잘 봤습니다! 수고하셨습니다~ |
|
코드 잘 봤습니다! 수고하셨습니다. |
kku1403
reviewed
Jul 11, 2025
| export function TodoProvider({ children }) { | ||
| const [todos, setTodos] = useState(() => getItem("todos", [])); | ||
|
|
||
| const lastId = useRef(Math.max(...todos.map((todo) => todo.id), 0) + 1); |
There was a problem hiding this comment.
이렇게 lastId값을 설정하면 예상치 못한 상황에서도 ID가 중복되지 않을 것 같아요! 좋은 방식이네요 :)
todos가 비었을 때를 처리하면 더 좋을 것 같아요!
| @@ -0,0 +1,47 @@ | |||
| import { createContext, useContext, useRef, useState, useEffect } from "react"; | |||
There was a problem hiding this comment.
context API로 상태 관리하신 점이 인상 깊어요.. 저는 어려워서 못했는데 태희님 코드 참고해서 개선해봐야겠습니다 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 ToDo List App
간단하고 직관적인 투두리스트 웹 애플리케이션입니다.
React로 개발되었으며, 로컬 스토리지를 통해 사용자의 할 일 데이터가 안전하게 보관됩니다.
📌 기술 스택
✔️ 주요 기능
🗂️ 프로젝트 구조
💻 미리보기
🚀 시작하기