-
Notifications
You must be signed in to change notification settings - Fork 39
[문지영] sprint6 #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[문지영] sprint6 #204
The head ref may contain hidden characters: "React-\uBB38\uC9C0\uC601-sprint6"
Conversation
addiescode-sj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!
주요 리뷰 포인트
- 스타일드 컴포넌트 구별 방식 관련 피드백
- 이미지 업로드 관련 문제 해결
| const preview = URL.createObjectURL(file); | ||
| setPreviewUrl(preview); | ||
|
|
||
| if (previewUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
본문에서 질문주신 문제에 대해 답변드리자면,
이미지를 삭제하고 다시 같은 이미지를 업로드할때 함수 내부의 previewUrl은 이전값(같은 값)을 참조하고 있는 상황이기때문에, 해당 조건이 true가 되어 그렇습니다. 따라서 이 상태를 직접 참조하는대신, 파일의 값이 있는지만(비어있는지 아닌지만) 확인하는식으로 조건을 수정하면 될것같네요!
| <StNavLink | ||
| to="/items" | ||
| $isActive={isMarketActive} | ||
| > | ||
| 중고마켓 | ||
| </StNavLink> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저번 PR에서 조언드렸던 코멘트인것같은데, 스타일드 컴포넌트를 구분짓기위한 의도라면 완전한 의미를 가진 StyledNavLink로 네이밍하시는게 좋을것같습니다.
혹은, NavLink로 네이밍하고 외부 파일로 분리해 불러올때
import * as S from '...' 이렇게 불러와서 구분하는 방식도 괜찮습니다.
| const [price, handlePriceChange] = useFormatNumber(''); | ||
| const [tags, setTags] = useState([]); | ||
|
|
||
| const isDisabled = name.trim() && description.trim() && price.trim() && tags.length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 조건이 반대로 되어있는것 아닌가요?
|
|
||
| <FormSection> | ||
| <ImageUpload /> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공백 지워주세요!
| const [name, setName] = useState(''); | ||
| const [description, setDescription] = useState(''); | ||
| const [price, handlePriceChange] = useFormatNumber(''); | ||
| const [tags, setTags] = useState([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굳굳! 각 필드를 개별적으로 업데이트할수있게 나누셨군요 👍
질문에 대한 답변
본문에서 자세히 답변드렸습니다!
커스텀 훅은 보통 이럴 경우에 쓰입니다:
정리하자면 커스텀 훅은 '재사용'과 '로직 분리'가 포인트로,
|
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게