Sunday, October 1, 2023

163: Pagination

 The demo app I'm creating has a section where the API returns a long list of data that when rendered into a table will scroll on and on basically forever. To make this section usable we need pagination to render our table into separate pages on a navigable list. I accomplished this by importing the Pagination component from Material UI and building one in the page to create a good looking interface to select your page. Like other controlled inputs this is connected to a React state. The state is then used in conjunction with javascript's slice() method to render the page of the table accordingly. The number of pages in the pagination is also dynamic, and is derived from a the number of current search results from the search bar. As the search becomes more broad or narrow the number of pages of results adjusts as needed. 

No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...