Skip to content
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

[Feature] 페이지네이션 구현 #24

Merged
merged 3 commits into from
Jan 1, 2024
Merged

[Feature] 페이지네이션 구현 #24

merged 3 commits into from
Jan 1, 2024

Conversation

binllionaire
Copy link
Member

close #23

Changes 📝

  • startpage css 개행수정
  • 페이지네이션 구현

PR Points 🔍

페이지네이션 부분 로직

  const itemsPerPage = 5;
  const [currentPage, setCurrentPage] = useState(0);

  const currentBooks = useMemo(() => {
    const start = currentPage * itemsPerPage;
    return bookData?.documents.slice(start, start + itemsPerPage) || [];
  }, [bookData, currentPage, itemsPerPage]);

  const handlePageChange = (pageNumber: number) => {
    setCurrentPage(pageNumber);
  };

useMemo를 사용하여 성능 최적화를 해봤습니다

Screenshot 📸

스크린샷 2024-01-01 오전 1 07 39 스크린샷 2024-01-01 오전 1 07 45

@moondda moondda merged commit db86f62 into develop Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] 페이지네이션
2 participants