[week6][박민서] 과제 제출#24
Open
charijyard wants to merge 1 commit into
Open
Conversation
Jack-Chagarr
reviewed
May 3, 2024
Comment on lines
+122
to
+130
| onClick={() => vote(1)} | ||
| /> | ||
| <img | ||
| src={thumbsDownImage} | ||
| className="w-20 h-20 cursor-pointer" | ||
| // ### thumbsDownImage Event ### | ||
| onMouseOver={handleThumbsDownHover} | ||
| onMouseOut={handleThumbsDownLeave} | ||
| onClick={() => vote(-1)} |
There was a problem hiding this comment.
잘 하셨는데, 이 부분에서 조금 더 가독성을 높일 수 있는 방법을 알려드릴게요!
const VoteValue = {
UP: 1,
DOWN: -1,
};
을 위에 선언해주고, vote(1) 대신 vote(VoteValue.UP), vote(-1) 대신 vote(VoteValue.DOWN) 로 값을 입력해줄 수 있어요!
내가 짠 코드도 일주일만 지나면 이게 뭐였지 하는 경우가 많고, 타인과 협업을 할 때는 다른 사람의 코드를 읽을 때 숫자나 문자가 그대로 하드코딩 되어있으면 이해하는데 시간이 필요한 경우가 많아서 이렇게 원하는 값을 좀 더 직관적으로 랩핑해주면 훨씬 더 좋은 코드를 작성할 수 있습니다~!
Author
There was a problem hiding this comment.
구체적이고 친절한 코멘트 감사드립니다! 참고해서 다음 번에는 더 좋은 코드 짤 수 있게 하겠습니다 ㅎㅎㅎ
|
코드 정상적으로 동작하는 것 확인했습니다~ 수고하셨어요!!! 나중에 시간 되실 때 심화 과제도 한 번 도전해보세요😁 |
Jack-Chagarr
approved these changes
May 3, 2024
yebin1926
reviewed
May 6, 2024
| ); | ||
|
|
||
| const data = response.data; | ||
| setImages(data[0]); |
There was a problem hiding this comment.
저는 다시 data.id 랑 data.url 을 새로운 변수에 저장해서 그걸 setImages() 로 pass 했는데 그럴 필요가 없었네요!
yebin1926
reviewed
May 6, 2024
| /> | ||
| {images ? ( | ||
| <img | ||
| src={images.url} |
There was a problem hiding this comment.
삼항 연산자를 src 안에서 하면 더 간단하게 할 수도 있을 것 같아요!
yebin1926
reviewed
May 6, 2024
| // ### thumbsDownImage Event ### | ||
| onMouseOver={handleThumbsDownHover} | ||
| onMouseOut={handleThumbsDownLeave} | ||
| onClick={() => vote(-1)} |
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.
💎 과제 구현 설명
🏁 PR 체크리스트
🖼️ Screenshot / Video
🙌 Issue