Skip to content

Conversation

kss761036
Copy link
Collaborator

요구사항

기본

  • 상품 등록 페이지 주소는 "/addboard" 입니다.
  • 게시판 이미지는 최대 한개 업로드가 가능합니다.
  • 각 input의 placeholder 값을 정확히 입력해주세요.
  • 이미지를 제외하고 input 에 모든 값을 입력하면 '등록' 버튼이 활성화 됩니다.
  • 상품 상세 페이지 주소는 "/board/{id}" 입니다.
  • 댓글 input 값을 입력하면 '등록' 버튼이 활성화 됩니다.
  • 활성화된 '등록' 버튼을 누르면 댓글이 등록됩니다

심화

  • 회원가입, 로그인 api를 사용하여 받은accessToken을 사용하여 게시물 등록을 합니다.

멘토에게

@kss761036 kss761036 requested a review from kich555 January 23, 2025 09:26
@kss761036 kss761036 added the 순한맛🐑 마음이 많이 여립니다.. label Jan 23, 2025
* 질문하기
* Comment 인터페이스의 타입을 전부 사용안했는데 오류가 나지않는 이유??
* 예를 들어 createdAt는 ?. 처럼 선택적이 아니지만 오류가 안남
*/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입스크립트 관련해서 질문있습니다.
Comment 인터페이스의 타입을 전부 사용안했는데 오류가 나지않는 이유가 뭘까요?

Copy link
Collaborator

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 사용 시 ?. 처리 안해줘도 됨.
Copy link
Collaborator Author

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, 이 옵션 사용해봐도 괜찮을까요?
아직 사용은 안했습니다

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strictNullChecks는 켜두는게 좋을것 같습니다!
무조건 필수인건 아니지만 좋은 습관을 위해선 필수라고 생각합니다

Copy link
Collaborator

@kich555 kich555 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~

Comment on lines +19 to +26
<img
src={
props.writer.image
? props.writer.image
: "/assets/img/icon_my.svg"
}
alt={props.writer.nickname}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src에 조건문을 넣기보단 src가 달라짐에따라 img 태그자체를 조건부 랜더링하는게 더 괜찮아보이네요

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 컴포넌트는 결국 input을 고스란히 반환할 뿐인 스타일컴포넌트군요 props의 확장성을 좀더 고민해보시면 좋겠네요

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위와 마찬가지입니다

Comment on lines +12 to +14
const ref = useOutsideClick(() => {
setMenu(false);
});
Copy link
Collaborator

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> => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise의 제네릭 에는 resolve 함수의 반환타입을 명시해주면 됩니다. 해당 api가 null도 명시적으로 반환하나요?

Comment on lines +7 to +8
const [title, setTitle] = useState("");
const [content, setContent] = useState("");
Copy link
Collaborator

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([
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise.allSetteld도 한번 같이 살펴보시면 좋을것 같네요

@kich555 kich555 merged commit d2b7b40 into codeit-bootcamp-frontend:Next-김승석 Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

순한맛🐑 마음이 많이 여립니다..

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants