-
Notifications
You must be signed in to change notification settings - Fork 37
[김승석] Sprint10 #311
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
[김승석] Sprint10 #311
The head ref may contain hidden characters: "Next-\uAE40\uC2B9\uC11D-sprint10"
Conversation
* 질문하기 | ||
* Comment 인터페이스의 타입을 전부 사용안했는데 오류가 나지않는 이유?? | ||
* 예를 들어 createdAt는 ?. 처럼 선택적이 아니지만 오류가 안남 | ||
*/ |
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.
타입스크립트 관련해서 질문있습니다.
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.
TypeScript는 타입을 선언하는 것만으로는 오류를 발생시키지 않습니다.
즉, 타입이 정의되어 있지만 사용되지 않았다고 해서 TypeScript가 이를 강제하지는 않습니다.
data, | ||
comment, | ||
}: InferGetServerSidePropsType<typeof getServerSideProps>) { | ||
// null 일수도 있어서 예외처리를 해줘야 아래 data 사용 시 ?. 처리 안해줘도 됨. |
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.
null 관련해서 tsconfig.ts에
"strictNullChecks": false, 이 옵션 사용해봐도 괜찮을까요?
아직 사용은 안했습니다
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.
strictNullChecks는 켜두는게 좋을것 같습니다!
무조건 필수인건 아니지만 좋은 습관을 위해선 필수라고 생각합니다
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.
고생하셨습니다~
<img | ||
src={ | ||
props.writer.image | ||
? props.writer.image | ||
: "/assets/img/icon_my.svg" | ||
} | ||
alt={props.writer.nickname} | ||
/> |
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가 달라짐에따라 img 태그자체를 조건부 랜더링하는게 더 괜찮아보이네요
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.
이 컴포넌트는 결국 input을 고스란히 반환할 뿐인 스타일컴포넌트군요 props의 확장성을 좀더 고민해보시면 좋겠네요
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 ref = useOutsideClick(() => { | ||
setMenu(false); | ||
}); |
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 fetchComments = async ( | ||
id: number | ||
): Promise<CommentListResponse | null> => { |
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.
Promise의 제네릭 에는 resolve 함수의 반환타입을 명시해주면 됩니다. 해당 api가 null
도 명시적으로 반환하나요?
const [title, setTitle] = useState(""); | ||
const [content, setContent] = 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.
이 두개의 상태는 하나로 묶을 수 있을것 같군요
* Promise.all을 활용해서 병렬로 처리해서 시간을 단축시킴. | ||
* 구조분해문법 사용해서 좀 더 깔끔하게 처리 | ||
*/ | ||
const [bestResponse, commonResponse] = await Promise.all([ |
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.
Promise.allSetteld
도 한번 같이 살펴보시면 좋을것 같네요
요구사항
기본
심화
멘토에게