-
Notifications
You must be signed in to change notification settings - Fork 44
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
[김한샘] Week12 #390
The head ref may contain hidden characters: "part2-\uAE40\uD55C\uC0D8-week12"
[김한샘] Week12 #390
Conversation
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.
고생하셨습니다! 👍
정말 죄송합니다. ㅠㅠㅠ 이번주까지 제가 담당인지 몰랏네요. 😭
- 필요할때마다 선언해둔 느낌이네요. 하나의 큰 타입을 두고 재활용하는 것이 좋습니다. (DRY 원칙)
- 변수명이 일관적이지 않고 보편적인 개발 컨벤션과 조금 다릅니다. 다른 분들의 코드를 더 많이 봐보세요.
- React에서 제공하는 타입들을 잘 활용해주셨네요!
Utility Type에 대해 알아보면 좋을 것 같습니다.
수고하셨습니다! 😁
@@ -9,14 +10,27 @@ import EditableStarButton from "./EditableStarButton"; | |||
import KebabButton from "./KebabButton"; | |||
import { useLocation } from "react-router-dom"; | |||
|
|||
function Card({ card }) { | |||
interface FolderCardData { |
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.
Card 컴포넌트의 Prop에 대한 type인데 CardPropType 정도로 표현하면 더 직관적이지 않을까요?
|
||
function KebabList({ url, setDisplay }) { | ||
const { openModal, setModalType, setCardUrl } = useContext(ModalContext); | ||
interface KebabListInterface { |
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.
변수명에 변수 타입이 들어가는 것이 안좋듯이, type과 interface도 마찬가지입니다.
interface UserFolderCardDataList { | ||
data: { | ||
id: number; | ||
createdAt: string; | ||
description?: string; | ||
folderId?: number; | ||
title?: string; | ||
updatedAt?: string; | ||
url: string; | ||
imageSource?: string; | ||
}; | ||
} |
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.
바로 위에 선언한 CardListData를 재활용하는 것이 좋습니다.
TS의 & 를 잘 이용해보세요.
import React from "react"; | ||
import "./Button.css"; | ||
|
||
interface buttonData { |
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.
타입의 이름들은 파스칼케이스로 작성해주시는 편이 좋습니다.
function FolderAddModal({ modalTypeLabels, modalType, cardUrl, folderTabDataList }) { | ||
const [activeId, setActiveId] = useState(null); | ||
interface UserFolderdataList { | ||
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.
굳이 data라는 depth가 필요할까요?
이 또한, 필요할 때마다 다른 내용을 보면서 선언하거나 하나의 정리된 타입을 사용하지 않아서 발생하는 이상한 타입의 전형입니다.
타입을 더 큰 범위에서 정리해보는 것이 좋을 것 같습니다.
interface FolderData { | ||
id: number; | ||
name: string; | ||
owner: { | ||
id: number; | ||
name: string; | ||
profileImageSource: string; | ||
}; | ||
links: { | ||
id: number; | ||
createdAt: string; | ||
url: string; | ||
title: string; | ||
description: string; | ||
imageSource?: string; | ||
}[]; | ||
count: number; | ||
} |
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.
몇번이나 봤던 interface가 계속 나오는거 같네요.
하나의 type으로 관리해보는 것이 좋을 것 같습니다.
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.
감사합니다.!
요구사항
기본
주요 변경사항
멘토에게