-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor: MemberImage 컴포넌트 추가 #15
Conversation
Test Results2 tests 2 ✅ 7s ⏱️ Results for commit b5a50bb. ♻️ This comment has been updated with latest results. |
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 [imageSrc, setImageSrc] = useState(src); | ||
|
||
const handleImageError = () => { | ||
setImageSrc(DefaultMemberImage); | ||
}; |
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.
상태에 경로를 담는것 보다 boolean으로 다루면 어떨까요??
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.
밑에서 그럼
{isError ? <DefaultMemberImage/> : <MemberImage /> }
이런식으로 처리하라는 말씀이신가요?!
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.
아래 src 속성에서 처리하면 좋아보여요.!
불린 속성에 따라 src가 변하게?!
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.
아 확인요
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 [isError, setIsError] = useState(false); | ||
|
||
const handleImageError = () => { | ||
setIsError(true); | ||
}; | ||
|
||
return ( | ||
<StyledMemberImage | ||
src={isError ? DefaultMemberImage : src} | ||
alt={alt} | ||
width={width} | ||
height={height} | ||
css={css} | ||
onError={handleImageError} | ||
/> | ||
); |
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.
👍
Issue
✨ 구현한 기능
📢 논의하고 싶은 내용
너무 오랜만에 코드 쳐서 잘 모르겠어요..
🎸 기타
⏰ 일정