-
Notifications
You must be signed in to change notification settings - Fork 6
Feat : 페이지네이션 작업 #76
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
Feat : 페이지네이션 작업 #76
Conversation
hongggyelim
left a comment
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.
고생하셨습니다!
junjeeong
left a comment
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.
고생하셨습니다!
| useEffect(() => { | ||
| const handleResize = () => { | ||
| const width = window.innerWidth; | ||
| setMaxPagesToShow(width > 1024 ? 5 : 3); |
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.
뭔가 햇더니 "1 2 3 ..... end" "1 2 3 4 5 .... end" 이냐의 분기점이군요👍
venise5224
left a comment
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.
수고하셨습니당
|
|
||
| switch (req.method) { | ||
| case "GET": | ||
| const { page = "1", pageSize = "10" } = req.query; |
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 page = parseInt((query.page as string) || "1", 10);
const pageSize = parseInt((query.pageSize as string) || "6", 10);
page, pageSize가 number 타입으로 넘어오는데 값이 없을 때는 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.
쿼리 파라미터는 문자열로 받아오기 때문에 number 로 지정하면 오류가 생기더라구요!
undefined 가 발생할 수도 있어어 string 으로 해주고 parseInt 를 사용해서 number 타입으로 변환하도록 했습니다~!
| {/* 페이지 번호와 생략 표시 */} | ||
| {getPageNumbers().map((pageNum, index) => | ||
| typeof pageNum === "number" ? ( | ||
| <li key={index} className={LiStyle}> |
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.
key에 index말고 다른게 딱히 생각나지는 않네요 😥
[Linkbrary #18]
작업 내용
Screenshot.2024-11-13.at.10.52.31.webm
추가 내용