Skip to content

Conversation

@YouD0313
Copy link
Contributor

@YouD0313 YouD0313 commented Dec 19, 2024

#️⃣연관된 이슈

#35

📝작업 내용

content-detail-page d9974c2

스크린샷 (선택)

💬리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

@YouD0313 YouD0313 added ✨ Feature 기능 개발 🎨 Html&css 마크업 & 스타일링 📬 API 서버 API 통신 🔨 Refactor 코드 리팩토링 labels Dec 19, 2024
Copy link

@hwookim hwookim left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!! 👍🏼 👍🏼
react query까지 아주 멋지게 사용해주셨네요.

그런데, pnpm-lock.yaml에 변경 사항이 있는 건 왜일까요?
node 버전이 유지님만 다른걸까요?
한 번 팀원들과 이야기해보고 node 버전을 맞춰보는 것도 중요한 작업이랍니다. 😄

const response = await httpClient.get<IContent>(`/api/posts/${content_id}`);
return response.data;
} catch (e) {
console.log('에러났어', e);
Copy link

Choose a reason for hiding this comment

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

앗, 에러 메시지가 귀엽네요 😄

Comment on lines +4 to +6
export interface FetchContentParams {
content_id: string | undefined;
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
export interface FetchContentParams {
content_id: string | undefined;
}
export interface FetchContentParams {
content_id?: string;
}

undefined가 올 수 있는 경우에는 ?를 이용하여 표시하기도 한답니다.
근데, 단 하나의 인자만 온다면 굳이 interface로 선언할 필요가 있을까요? 🤔
type으로 선언해도 충분할 것 같기도 합니다.
그렇다면 ?는 못쓰겠지만요 😅

Comment on lines +7 to +13
export default function QuestionContent({ content }: Props) {
return <QuestionContentStyle>{content}</QuestionContentStyle>;
}

const QuestionContentStyle = styled.div`
font-size: 15px;
`;
Copy link

Choose a reason for hiding this comment

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

이정도 컴포넌트라면 단순 스타일 컴포넌트만으로 부모에서 만들어 써도 되지 않았을까 싶기는 하네요 🤔
나중의 확장성을 위해 미리 분리해두신 걸까요? 👀

);
}

const QuestionCommentStyle = styled.div`
Copy link

Choose a reason for hiding this comment

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

스타일 컴포넌트와 classname을 혼합해서 쓰시는 이유가 있을까요? 👀
CommentContainer
CommentTitle
CommentInput
같은 형식으로 styled-component만 써도 충분히 표현할 수 있을 것 같아요 👀

물론 class name을 혼합하여 쓰는 것이 잘못된 방식은 아닙니다.
다만 여러 방식을 혼재해서 쓸 경우 나중에는 헷갈리게 되거나 유지보수가 힘들어질 수도 있어서요.
특별한 경우가 아니라면 하나의 도구를 사용하는 편이 좋다고 생각해요 😄

const { data } = useQuery({
queryKey: ['content', content_id],
queryFn: async () => await fetchContent({ content_id }),
enabled: !!content_id,
Copy link

Choose a reason for hiding this comment

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

content_id가 혹시혹시 0이면 어떡하죠...?! 👀
물론 사실 그럴 일 없다는 백엔드의 말 하나면 해결되긴 합니다 ㅋㅋ 하지만 혹시...?

@@ -0,0 +1,27 @@
export interface IPost {
Copy link

Choose a reason for hiding this comment

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

IPost라는 네이밍은 interface임을 나타낼 수 있는 괜찮은 네이밍이지만,
전반적인 프로젝트를 봤을 때 다른 인터페이스들과는 달라보이네요.

한 번 통일시킬 필요가 있어보여요.
만일 새로운 사람이 IPost를 먼저 보고 다른 인터페이스를 본다면, 우선적으로 인터페이스가 아니라고 여길 수 있으니깐요 👀
가장 중요한 것은 팀 컨벤션!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📬 API 서버 API 통신 ✨ Feature 기능 개발 🎨 Html&css 마크업 & 스타일링 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants