-
Notifications
You must be signed in to change notification settings - Fork 35
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
[신윤하] Sprint10 #300
The head ref may contain hidden characters: "Next-\uC2E0\uC724\uD558-sprint10"
[신윤하] Sprint10 #300
Conversation
import ArticleSection from "@/components/Boards/ArticleSection"; | ||
import BestArticleSection from "@/components/Boards/BestArticleSection"; | ||
import Header from "@/components/Header"; |
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.
현재 디렉토리 가져올 때 @/components
되어있는데, tsconfig 값에 paths 수정하는 방향으로 아래처럼 바꿔보면 가독성이 더 좋을 것 같습니다 😄
import ArticleSection from "@components/Boards/ArticleSection";
import BestArticleSection from "@components/Boards/BestArticleSection";
import Header from "@components/Header";
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 handleChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
setValue(e.target.value); | ||
}; |
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.
아래처럼 이벤트 핸들러 함수들은 useCallback
사용해서 메모이제이션하는 방법도 있어요. 이런 경우, 불필요한 리랜더링을 방지해줄 수 있습니다.
const handleChange = (e: ChangeEvent<HTMLInputElement>) => { | |
setValue(e.target.value); | |
}; | |
const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { | |
setValue(e.target.value); | |
}, []); |
// const [articles, setArticles] = useState(); | ||
|
||
// // const viewportWidth = useViewport(); | ||
|
||
// useEffect(() => { | ||
// // if (viewportWidth === 0) return; | ||
|
||
// const fetchBestArticles = async (size: number) => { | ||
// try { | ||
// const response = await fetch( | ||
// `https://panda-market-api.vercel.app/articles?orderBy=like&pageSize=${size}` | ||
// ); | ||
// const data: ArticleListResponse = await response.json(); | ||
// setArticles(data.list); | ||
// } catch (error) { | ||
// console.error("Failed to fetch best articles:", error); | ||
// } | ||
// fetchBestArticles(newPageSize); | ||
// }; | ||
// }, []); |
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.
불필요한 주석은 제거해주시는게 좋아요~
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게