-
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
Part2 장성훈 week12 #406
The head ref may contain hidden characters: "part2-\uC7A5\uC131\uD6C8-week12"
Part2 장성훈 week12 #406
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.
고생하셨습니다!!
전체적으로 너무 잘 해주셨어요!!
앞으로도 이대로만 계속 가주시면 좋을것 같네요 ㅎㅎ
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.
호오 hasOwnProperty 쓴거 좋습니다 ㅎ근데 위 조건일때만 값을 반환하는건 문제가 있을것 같아요
useGetFolder
는 항상 loading, error, data상태는 반환해야 useGetFolder
를 사용하는 쪽에서 문제가 없을것 같습니다
mapFolderData()를 꼭 사용해야만 한다면
if (data && data.hasOwnProperty('folder')) {
const folderData = mapFolderData(data);
}
구문은 useGetFolder
안이 아니라 useGetFolder
를 선언하는 쪽에서 사용하는게 좋을것 같네요 ㅎ
Component = ()=> {
const [folderData,setFolderData]=useState(null)
const {data,loading,error} = useGetFolder()
if (data && data.hasOwnProperty('folder')) {
setFolderData(mapFolderData(data))
}
return <div> ...
}
이렇게요!
|
||
const cx = classNames.bind(styles); | ||
interface FolderToolBar { | ||
folders: ; |
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.
잉 이부분은 eslint가 에러 안띄우나요?
혹시나 프로젝트에 eslint, prettier가 세팅안되어있다면 필수로 세팅해주세요!
interface FolderToolBar { | ||
folders: ; | ||
selectedFolderId: string; | ||
onFolderClick: React.SetStateAction<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.
그렇게 작성하시는것도 물론 좋지만 그냥 (string)=>void;
해도 되긴 합니다!
title: string; | ||
description: 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.
보통 이러면
interface Link = {
id: number;
createdAt: string;
url: string;
title: string;
description: string;
imageSource: string;
}
links: Link[]
이렇게 나눠주는게 좋아요!
import { mapLinksData } from 'link/util-map/mapLinksData'; | ||
import { useAsync } from 'sharing/util'; | ||
import { ALL_LINKS_ID } from './constant'; | ||
import { Link } from 'sharing/util'; |
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.
요긴 한칸 띄워두는게 더 좋겠네요
profileImageSource: string; | ||
}; | ||
}; | ||
links: { |
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.
이건 타입을 Link[]로 바꿔주는게 좋을것 같아요
export const useAsync = ( | ||
asyncFunction: () => Promise<AxiosResponse<any, any>> | ||
) => { | ||
const [loading, setLoading] = useState(false); |
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 [loading, setLoading] = useState(false);
setData(response.data); | ||
return response; | ||
} catch (error) { | ||
if (error instanceof AxiosError) setError(error.message); |
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.
setError에는 error객체 자체를 주는게 더 나아보여요!
const rootElement = document.getElementById(ROOT_ID); | ||
rootElement?.addEventListener('click', callback); | ||
return () => { | ||
rootElement?.removeEventListener('click', callback); |
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.
👍👍👍 unMount될 때 등록한 이벤트리스너 회수하는거 좋습니다!
import { useAsync } from 'sharing/util'; | ||
import { axiosInstance } from 'sharing/util'; | ||
|
||
interface UserData { |
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.
UserData를 선언만하고 사용하는부분은 안보이네요?
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.
만약에 이유가 있다면 주석을 통해 이유를 남겨주시면 더 좋을것 같아요!!
요구사항
기본
주요 변경사항
해결 못한 부분