Merged
Conversation
Comment on lines
+13
to
+18
| onClick={() => { | ||
| setSubmitted(false); | ||
| setErrorCategory(-1); | ||
| setQuestionName(""); | ||
| setDetailInput(""); | ||
| }} |
Member
There was a problem hiding this comment.
이런 로직이 onClick 다이렉트로 적어 놓는 것이 아니라 handleClick 이런식으로 빼서 위에 정의를 해놓는게, 가독성 면도 그렇고 의미 측면에서도 좋다고 생각합니다.
|
|
||
| export default function ErrorReport() { | ||
| const [submitted, setSubmitted] = useState(false); | ||
| const [errorCategory, setErrorCategory] = useState(-1); |
Member
There was a problem hiding this comment.
숫자가 아닌 실제 옵션 명으로 state가 정의 되어있으면 좋을 것 같아요. 숫자로 어떤 선택지인지 파악하기가 어렵습니다!
| const [detailInput, setDetailInput] = useState(""); | ||
|
|
||
| return submitted ? ( | ||
| <div> |
Member
There was a problem hiding this comment.
div 대신 용어를 담은 StyledComponent를 사용하면 해당 페이지의 구조를 더 파악하기 쉬울 것 같아요!
| <label htmlFor="errorCategory2">기타</label> | ||
| </div> | ||
|
|
||
| {errorCategory === -1 || errorCategory === 1 ? null : ( |
Member
There was a problem hiding this comment.
순차적 렌더링을 위해 분기가 많이 생길 수 밖에 없는데요! 이러한 부분도 handleClick을 분리 했던 것 처럼 로직을 return 외부로 분리 시키면 좋을 것 같아요. 예를 들면 isQuestionNameVisible 이런식으로 선언해둘 수 도 있겠네요! 이러한 비슷한 값들을 담은 하나의 객체나 상태를 선언해도 좋을 것 같구요
Closed
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.
작업 내용
관련 Issue
Close #1
생각해볼 내용
이후 작업할 내용