Conversation
Summary of ChangesHello, 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은 할일 추가, 삭제, 완료 기능을 제공하며 Highlights
🧠 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 AssistThe 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
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 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
|
| export const getItem = (key, defaultValue) => { | ||
| const value = storage.getItem(key) | ||
| if (value == null) return defaultValue | ||
| return JSON.parse(value) | ||
| } |
There was a problem hiding this comment.
JSON.parse(value) 호출은 localStorage의 데이터가 손상되었거나 유효한 JSON 형식이 아닐 경우 오류를 발생시켜 전체 애플리케이션을 중단시킬 수 있습니다. try...catch 블록으로 감싸고 파싱에 실패할 경우 defaultValue를 반환하도록 하여 안정성을 높이는 것이 좋습니다.
| export const getItem = (key, defaultValue) => { | |
| const value = storage.getItem(key) | |
| if (value == null) return defaultValue | |
| return JSON.parse(value) | |
| } | |
| export const getItem = (key, defaultValue) => { | |
| const value = storage.getItem(key) | |
| if (value === null) { | |
| return defaultValue | |
| } | |
| try { | |
| return JSON.parse(value) | |
| } catch (error) { | |
| console.error(`localStorage에서 키 "${key}"에 대한 JSON 파싱 중 오류 발생:`, error) | |
| return defaultValue | |
| } | |
| } |
src/components/TodoItem.jsx
Outdated
| return ( | ||
| <li style={{ textDecorationLine: todo.checked ? 'line-through' : 'none' }}> | ||
| <input className="check-box" type="checkbox" onChange={() => toggleTodo(todo.id)} checked={todo.checked} /> | ||
| {todo.id} : {todo.text} |
| const handleSubmit = (e) => { | ||
| e.preventDefault() | ||
| const form = e.target | ||
| if (form.todo.value == '') { |
| e.preventDefault() | ||
| const form = e.target | ||
| if (form.todo.value == '') { | ||
| alert('할일을 입력해주세요') |
| const removeTodo = (id) => { | ||
| setTodos(todos.filter((todo) => todo.id != id)) | ||
| } | ||
|
|
||
| const toggleTodo = (id) => { | ||
| setTodos(todos.map((todo) => (todo.id != id ? todo : { ...todo, checked: !todo.checked }))) | ||
| } |
There was a problem hiding this comment.
removeTodo와 toggleTodo 함수에서 != 연산자를 사용하고 있습니다. 자바스크립트에서는 예기치 않은 타입 강제 변환을 피하기 위해 엄격한 (불)일치 연산자인 ===와 !==를 사용하는 것이 모범 사례입니다.
| const removeTodo = (id) => { | |
| setTodos(todos.filter((todo) => todo.id != id)) | |
| } | |
| const toggleTodo = (id) => { | |
| setTodos(todos.map((todo) => (todo.id != id ? todo : { ...todo, checked: !todo.checked }))) | |
| } | |
| const removeTodo = (id) => { | |
| setTodos(todos.filter((todo) => todo.id !== id)) | |
| } | |
| const toggleTodo = (id) => { | |
| setTodos(todos.map((todo) => (todo.id !== id ? todo : { ...todo, checked: !todo.checked }))) | |
| } |
No description provided.