Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Implementing pagination

Pagination is an important pattern when working with large and user-generated lists of objects. Pagination divides the content into separate pages and thereby limits the number of objects that must be loaded for a given page. Pagination aims to reduce load times and improve performance.

In this section, we will implement pagination in BeeRich for expenses and invoices:

  1. First, open the dashboard.expenses.tsx route module and define a constant for the page size:
    const PAGE_SIZE = 10;

    The page size defines the number of expenses we will show at once in the expenses overview list. To see more expenses, the user has to navigate to the next page.

  2. Update the loader function in dashboard.expenses.tsx and access a new search parameter named page:
    const userId = await requireUserId(request);const url = new URL(request.url);const searchString = url.searchParams.get('q');const pageNumberString = url.searchParams.get('page');const pageNumber...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf