Pagination Explained

Table of contents

No heading

No headings in the article.

I write code often and pagination is common thing I implement as a backend developer, when building an API and in any way returning data from the database, I utilize pagination to display the data in a friendly way to users, imagine we have 10,000 product in our database, this is practically not possible to be shown in our website at ones.

The job of pagination is to allow you bring in this product or display them in batches, just like your regular books, you have page 1, page 2 and so on. Let's say in 10 batches each, as the user visit our website the user can see 10 product listings and an arrow or a NEXT button that will allow the user to move to the next page without leaving the webpage he is using.

This is a great features that is used in mostly all the app out there. Let take Facebook for instance as you are scrolling down they page p Keep paginating and be bringing up more content for you to see like wise Twitter, LinkedIn and other social networks, And when we talk about pagination as a programmer one thing that most come to your mind is:

  1. Limit

  2. Offset

The Limit is the limit of numbers you want to display let's say 20 out of 160 then 20 is the Limit, then the offset specifies where to start fetching the next product from, that is the next number to begin from.

Was this helpful?