New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

reactjs-forpagination

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

reactjs-forpagination

A simple pagination component to use inside your react projects.

unpublished
latest
Source
npmnpm
Version
2.1.7
Version published
Maintainers
1
Created
Source

react-pagination-component

A simple pagination component to use inside your react projects.

Demo

pagination component

Demo

View sample code on codesandbox.

How to use

Install

1. npm i pagination-for-reactjs-component --save

2. Import pagination component inside react

  • With bootstrap design
import Pagination from 'pagination-for-reactjs-component'
import "bootstrap/dist/css/bootstrap.min.css";
  • With material ui
import MuiPagination from 'pagination-for-reactjs-component/mui'

3. Call the pagination function and pass parameters

Inside your render or return

  • for bootstrap
        <PaginationComponent
          pageCount={pageCount}
          pageIndex={pageIndex}
          setPageIndex={setPageIndex}
        />
  • for material ui
        <MuiPagination
          pageCount={pageCount}
          pageIndex={pageIndex}
          setPageIndex={setPageIndex}
        />

4. Definitions

  • pageCount
(variable, type:integer), pass the value of the total number of pages or numbers for your pagination
  • pageIndex
(variable, type:integer), pass the value of the current page number within your series.
  • setPageIndex
(function, react hook), this hook receives intergers to pass to pageIndex for navigation

5. Custom styling

  • Top style, access the pagination css class and implement your design
  • Default styling
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
}

ul {
    display: block;
    list-style-type: disc;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-inline-start: 40px;
}

6. Sample Code

import { React, useState } from "react";
import Pagination from "pagination-for-reactjs-component";
import MuiPagination from "pagination-for-reactjs-component/mui";
import "bootstrap/dist/css/bootstrap.min.css";

export default function App() {
  const [pageIndex, setPageIndex] = useState(1);
  let pageCount = 200;

  return (
    <>
      <div className="container-fluid mx-3">
        <h1>You are on page {pageIndex}</h1>

        <span>bootstrap design</span>
        <Pagination
          pageCount={pageCount}
          pageIndex={pageIndex}
          setPageIndex={setPageIndex}
        />

        <span>material ui design</span>
        <MuiPagination
          pageCount={pageCount}
          pageIndex={pageIndex}
          setPageIndex={setPageIndex}
        />
      </div>
    </>
  );
}

Keywords

react

FAQs

Package last updated on 06 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts