All in How To
January 15, 2026 Kunal Burangi

How to Implement Pagination in a React JS Application for Faster Loading and Better UX

How to Implement Pagination in a React JS Application for Faster Loading and Better UX

When a React application starts to grow, one of the first problems developers face is handling large amounts of data. Imagine loading hundreds of users, products, or blog posts on a single page. The browser becomes slower, the UI feels heavy, and users start losing interest. Pagination solves this by breaking large datasets into smaller, manageable chunks so only a few records are shown at a time.

Pagination is not just about improving performance. It also improves readability, makes navigation easier, and creates a more professional user experience. This is why almost every modern web application — from e-commerce platforms to job portals — uses pagination.

Let’s understand how pagination works in a real React JS application.

At its core, pagination is simply slicing an array of data based on the current page. You decide how many items should appear per page, calculate which records belong to that page, and render only those records.

Assume you have a list of 100 users coming from an API or a database.


const users = Array.from({ length: 100 }, (_, i) => ({
  id: i + 1,
  name: `User ${i + 1}`
}));

Next, we decide how many records to show per page and track the current page.


import { useState } from "react";

const itemsPerPage = 10;

const PaginationExample = () => {
  const [currentPage, setCurrentPage] = useState(1);
};

Now we calculate which items belong to the current page.


const indexOfLastItem = currentPage * itemsPerPage;
const indexOfFirstItem = indexOfLastItem - itemsPerPage;
const currentItems = users.slice(indexOfFirstItem, indexOfLastItem);

This logic means:

  • Page 1 shows items 1–10
  • Page 2 shows items 11–20
  • Page 3 shows items 21–30

Only these sliced items are rendered, keeping the UI fast and efficient.

To display them in React:


<ul>
  {currentItems.map((user) => (
    <li key={user.id}>{user.name}</li>
  ))}
</ul>

Next, we need pagination controls so users can move between pages. First, calculate the total number of pages.


const totalPages = Math.ceil(users.length / itemsPerPage);

Then generate page buttons dynamically.


<div>
  {Array.from({ length: totalPages }, (_, i) => (
    <button key={i} onClick={() => setCurrentPage(i + 1)}>
      {i + 1}
    </button>
  ))}
</div>

Every time the user clicks a page number, the currentPage changes and React automatically updates the displayed data.

To make the UI even better, we add Next and Previous buttons.


<button disabled={currentPage === 1} onClick={() => setCurrentPage(currentPage - 1)}>
  Previous
</button>

<button disabled={currentPage === totalPages} onClick={() => setCurrentPage(currentPage + 1)}>
  Next
</button>

In real production applications, you usually don’t load all records at once. Instead, the backend sends paginated data.

A typical API request looks like this:


fetch(`/api/users?page=${currentPage}&limit=10`)

This way, your React app only downloads what it needs, making it much faster and more scalable.

Well-implemented pagination improves not only performance but also SEO. Search engines prefer pages that load quickly and display structured, clean content. If you keep the page number in the URL and load paginated data properly, your React application becomes both user-friendly and search-engine friendly.

Pagination might look simple, but it is one of the most powerful techniques to build professional, high-performance React applications that scale as your data grows.

Related Tags

react hooks, frontend optimization, ui ux best practices, web performance, api handling, javascript arrays, client side pagination, server side pagination, scalable react apps

Kunal Burangi

Founder & Career Strategist

Kunal is the founder of CreateYourResume and a dedicated career strategist. He helps professionals across the globe build ATS-optimized resumes that land interviews at top companies.

Read more about us
#how to implement pagination in react#react js pagination#react pagination example#pagination in react application#react frontend pagination#api pagination react#react pagination best practices#javascript pagination#pagination ui react#react performance optimization

Recent Posts

Dec 30, 2025

Free Resume Builder: The Complete Guide to Creating a Job-Winning Resume Online

Building a resume does not have to be expensive, complicated, or time-consuming. Whether you are a fresher applying for your first job, a professional updating your profile, or someone switching careers — the right resume can open doors you never thought possible. This complete guide covers everything you need to know: the best resume formats, ATS-friendly templates, free online resume builders, step-by-step writing tips, and the smartest tools available today. By the end, you will know exactly how to create a professional, job-winning resume for free — without needing a designer or a career coach.

Read Article
Dec 30, 2025

How to Use ChatGPT to Write a Resume: A Step-by-Step Guide for Job Seekers

Writing a resume can feel overwhelming — especially when you are staring at a blank page not knowing where to start. ChatGPT has changed the way job seekers approach resume writing. From crafting a compelling summary to writing powerful bullet points, ChatGPT can help you build a strong, professional resume faster than ever before. But knowing how to use it the right way makes all the difference. This guide walks you through exactly how to use ChatGPT to write a resume — with real prompts, examples, and how to combine it with CreateYourResume.in for a truly standout result.

Read Article
Dec 30, 2025

ATS Friendly Resume Template: What It Is, Why It Matters, and How to Get One That Works

An ATS friendly resume template is a resume format designed to be easily read and parsed by Applicant Tracking Systems — the software most companies use to screen job applications before a human ever sees them. If your resume is not ATS compatible, it could be getting rejected automatically, no matter how qualified you are. This guide explains exactly what ATS friendly means, how these systems work, what to include in your resume, and how tools like CreateYourResume.in can help you build a job-winning resume in minutes.

Read Article

More in How To

Dec 30, 2025

How to Use ChatGPT to Write a Resume: A Step-by-Step Guide for Job Seekers

Writing a resume can feel overwhelming — especially when you are staring at a blank page not knowing where to start. ChatGPT has changed the way job seekers approach resume writing. From crafting a compelling summary to writing powerful bullet points, ChatGPT can help you build a strong, professional resume faster than ever before. But knowing how to use it the right way makes all the difference. This guide walks you through exactly how to use ChatGPT to write a resume — with real prompts, examples, and how to combine it with CreateYourResume.in for a truly standout result.

Read Article
Dec 30, 2025

How to Become an AI Developer in 2026: What AI Is, How AI Agents Work, and How to Build Your Own ChatGPT-Like Project

Artificial Intelligence is no longer a futuristic concept—it is a practical skill shaping careers across software development, data science, and product engineering. As we move into 2026, becoming an AI developer requires more than just learning a few libraries. It involves understanding how AI works, how intelligent agents make decisions, and how real-world AI systems like ChatGPT are built and deployed. This in-depth guide explains how to become an AI developer in 2026 from the ground up. It starts by clearly explaining what artificial intelligence actually is, how modern AI differs from traditional programming, and where AI is used in real applications. You will then learn what AI agents are, how they think, plan, and act, and how developers design them using modern tools and frameworks. The guide also walks through building a small ChatGPT-like project for personal learning, covering system design, model usage, memory, and safety considerations. Along the way, it compares tools, skills, and learning paths, highlights common mistakes beginners make, and explains what companies actually expect from AI developers today. This article is written in simple, practical language and is designed to be SEO-friendly, AI-search friendly, and suitable for long-term indexing by Google.

Read Article
Dec 30, 2025

How to Create a Resume for Internship for BE Students (Step-by-Step Guide)

Learn how BE students can create a professional internship resume using CreateYourResume.in with real examples, skills, projects, and fresher tips.

Read Article