Pagination
When there’s a large number of data items to display, it’s common to use pagination to display one page of items at a time. Each page displays a number of items whose data can be fetched from the server quickly compared to fetching data for all the items at once.
Let’s look at an example that renders images found in the public/images directory of a web app. Another interesting option is to render the names and images of Pokémon characters retrieved from a public API that returns JSON data. See The RESTful Pokémon API[35] to try this.
The following HTML renders a table that’s populated by sending a GET request to the /image-rows endpoint when the page is loaded. It uses the query parameter page to indicate which page of images should ...
Get Server-Driven Web Apps with htmx now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.