Open
Conversation
inti0
reviewed
Jul 10, 2025
inti0
left a comment
There was a problem hiding this comment.
아직 중간 피드백 단계입니다! todo앱의 로직 자체는 괜찮으니 localstorage 저장부분을 잘 고치면 제출 전까지 좋은 코드 완성할 수 있을 것 같습니다.
| }; | ||
| lastId.current++; | ||
| return todo; | ||
| }; |
There was a problem hiding this comment.
createTodo는 단순히 객체를 생성하는 함수인데 Id를 여기서 관리하는 것은 맞지 않을 것 같습니다.
| import { getStorage, setStorage } from "../utils/storage"; | ||
|
|
||
| function useTodos() { | ||
| const [todos, setTodos] = useState(() => getStorage("todos") || []); //useState 대신 Ref방식이 좋다 |
|
|
||
| export function getStorage(key) { | ||
| return JSON.parse(localStorage.getItem(key)); | ||
| } |
There was a problem hiding this comment.
storage 파일이 미완성이라 todo앱의 기능이 정상작동하지 않는 것 같습니다 😢
dbjoung
reviewed
Jul 14, 2025
dbjoung
left a comment
There was a problem hiding this comment.
컴포넌트는 UI만, 그 외 로직은 대부분 useTodos에 들어있어서 깔끔하다고 느꼈습니다. 이해하기 쉬운 코드였던 것 같습니다. 많이 배웠습니다. 과제 수행 고생하셨습니다.
| function App() { | ||
| const { todos, addTodo, toggleTodo, removeTodo } = useTodos(); | ||
|
|
||
| const handleSubmit = (e) => { |
There was a problem hiding this comment.
handleSumit도 useTodos에 넣으면 더 깔끔해질 것 같습니다.
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.
No description provided.