-
Notifications
You must be signed in to change notification settings - Fork 57
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
[이찬주] week14 #425
The head ref may contain hidden characters: "part3-\uC774\uCC2C\uC8FC-week14"
[이찬주] week14 #425
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.
고생하셨습니다. 곧 프로젝트 시작인데 화이팅하시고 질문사항 생기면 언제든지 알려주세요!
|
||
export const mapFoldersData = (folders?: FolderRawData[]): Folder[] => { | ||
export const mapFoldersData = (folders?: Folder[]): FolderShown[] => { | ||
if (!folders) return []; |
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.
folders
가 최소한 Array타입인 게 보장이 된다면, 이 4행은 필요가 없을 것 같습니다. 어차피 밑에서 빈 배열에 map 걸어도 결과는 빈 배열이니 상관 없을 거 같아요.
favorite: boolean; | ||
}; | ||
|
||
export type FolderShown = { |
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.
FolderShown
는 얼핏 봤을 때 의도를 파악하기가 쉽지 않은 이름이라고 생각합니다. API 응답으로 온 데이터의 타입과 실제로 UI에 렌더링하기 위한 값을 의미하는 건가요?
favorite: boolean; | ||
}; | ||
|
||
export type FolderShown = { |
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.
위에 FolderRawData
도 있는 것 같습니다. 이런 경우 Folder
는 FolderRawData
기준으로 만든다던가 하는 다양한 방식도 생각해볼 수 있을 것 같습니다. (ex. 인터페이스의 상속을 이용)
|
||
export const mapFoldersData = (folders?: FolderRawData[]): Folder[] => { | ||
export const mapFoldersData = (folders?: Folder[]): FolderShown[] => { |
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.
export const mapFoldersData = (folders: Folder[] = []): FolderShown[]
같은 식으로 기본 값을 부여해줘도 좋을 것 같습니다.
요구사항
기본
심화
주요 변경사항
멘토에게