-
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 #375
The head ref may contain hidden characters: "part2-\uC815\uC9C0\uC131-week12"
[정지성] week12 #375
Conversation
커밋을 Style: Convert into tsx 로 주셨는데, js 를 ts 로 바꾸는 것은 Refactor 에 가까울 거 같아요! |
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 Link { | ||
id: string; | ||
url: string; | ||
imageSource?: string; | ||
title: string; | ||
createdAt: Date; | ||
description: 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.
프로젝트 전반에 걸쳐 사용되는 타입들은 묶어서 types 폴더에 넣어주셔도 좋을 거 같아요!
실제 사용하실 때는 �import 로 가져와서 바로 쓰심 됩니다!
interface Link { | |
id: string; | |
url: string; | |
imageSource?: string; | |
title: string; | |
createdAt: Date; | |
description: string; | |
} | |
export interface Link { | |
id: string; | |
url: string; | |
imageSource?: string; | |
title: string; | |
createdAt: Date; | |
description: string; | |
} |
@@ -162,7 +181,7 @@ function Foldermenu() { | |||
targetName={activeButton} | |||
onClose={handleCloseShareModal} | |||
isModalOpen={isModalShareOpen} | |||
currentFolderId={currentFolderId} // currentFolderId 전달 | |||
currentFolderId={currentFolderId || undefined} |
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.
currentFolderId={currentFolderId || undefined} | |
currentFolderId={currentFolderId} |
|| undefined 를 주시는 것은 안주시는 것과 동일해요! (Id 가 0 일 때 undefined를 할당하고 싶으신 게 아니라면)
interface UserProfile { | ||
data: { | ||
email: string; | ||
image_source: 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.
UserProfile 인데 받아오는 값들은 UserProfile 목록인 거 같아요!
{
email: string;
image_source: string;
}
자체를 UserProfile
로 설정하고,
데이터 fetching 해서 오는 모든 데이터들에 대한 타입을 정의해주시면, 좋을 거 같아요! (https://www.typescriptlang.org/docs/handbook/2/generics.html 참고해보시면 좋을 거 같아요!)
type UserProfiles = FetchData<UserProfile[]>
요런 식이 될 거 같아요!
links: Link[]; | ||
onSearch: (filteredLinks: Link[]) => void; | ||
}) => { | ||
const [searchTerm, setSearchTerm] = 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.
const [searchTerm, setSearchTerm] = useState(''); | |
const [searchTerm, setSearchTerm] = useState<string>(''); |
'' 은 다양한 타입이 될 수 있어서 되도록 붙여주시는 게 좋아요!
@@ -0,0 +1,33 @@ | |||
import moment from 'moment'; | |||
|
|||
// 날짜 형식을 변경하는 함수 |
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.
이런 util 류는 input, output 예시를 위에 주석으로 적어주시면 가독성이 매우 좋아져요!
// 날짜 형식을 변경하는 함수 | |
// 날짜 형식을 변경하는 함수 new Date -> 2024.05.07 |
onClose(false); | ||
}; | ||
|
||
return isModalOpen ? ( |
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.
이렇게 앞이 길고 뒤가 짧은 경우에는 그냥 짧은 부분부터 쳐내주시는 게 가독성이 좋아요!
return isModalOpen ? ( | |
return !isModalOpen ? null : |
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게