Gathering detailed insights and metrics for react-hooks-paginator
Gathering detailed insights and metrics for react-hooks-paginator
Gathering detailed insights and metrics for react-hooks-paginator
Gathering detailed insights and metrics for react-hooks-paginator
npm install react-hooks-paginator
v0.5.3
Published on 16 Aug 2024
v0.5.2
Published on 16 Aug 2024
v0.5.1
Published on 05 Mar 2023
Reduce app bundle size
Published on 21 Jan 2020
Custom class for next and previous button
Published on 09 Sept 2019
Add custom styles with option to customise
Published on 28 Aug 2019
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
20 Stars
97 Commits
6 Forks
3 Watching
18 Branches
2 Contributors
Updated on 04 Sept 2024
Minified
Minified + Gzipped
HTML (90.54%)
JavaScript (8.7%)
SCSS (0.69%)
Shell (0.07%)
Cumulative downloads
Total Downloads
Last day
-18.9%
554
Compared to previous day
Last week
13.4%
3,222
Compared to previous week
Last month
7.2%
12,649
Compared to previous month
Last year
10.3%
107,018
Compared to previous year
28
A library for adding simple paginator functionality to your react app.
Requires react >= 16.8.0
Run the following command:
npm install react-hooks-paginator
1import React, { useState } from 'react'; 2import ReactDOM from 'react-dom'; 3import Paginator from 'react-hooks-paginator'; 4 5function App() { 6 const [offset, setOffset] = useState(0); 7 const [currentPage, setCurrentPage] = useState(1); 8 9 const data = [page1, page2, page3, page4, page5, page6]; 10 11 return ( 12 <div> 13 <Paginator 14 totalRecords={data.length} 15 pageLimit={4} 16 pageNeighbours={1} 17 setOffset={setOffset} 18 currentPage={currentPage} 19 setCurrentPage={setCurrentPage} 20 /> 21 </div> 22 ); 23} 24 25export default App;
Property | Type | Default | Description |
---|---|---|---|
totalRecords | Number (required) | The length of the data we are tabulating | |
pageLimit | Number (required) | Minimum number of records per page | |
pageNeighbours | Number (required) | Number of page blocks by the left and right of the middle page | |
setOffset | function (required) | function that updates the offset state | |
setCurrentPage | function (required) | function that updates the current page state | |
currentPage | Number (required) | The current page state | |
pageContainerClass | String | react-hooks-paginator | Paginator container classname |
pageActiveClass | String | active | Active page item classname |
pageItemClass | String | page-item | Page item classname |
pageLinkClass | String | page-link | Page link classname |
pagePrevText | String or Node | Next » | Prev page item text |
pageNextText | String or Node | « Prev | Next page item text |
pagePrevClass | String | page-link | Prev page custom class |
pageNextClass | String | next-link | Next page custom class |
1import React, { useState, useEffect } from 'react'; 2import ReactDOM from 'react-dom'; 3import Paginator from 'react-hooks-paginator'; 4import { fetchData } from './data-fetcher'; 5 6function App() { 7 const pageLimit = 10; 8 9 const [offset, setOffset] = useState(0); 10 const [currentPage, setCurrentPage] = useState(1); 11 const [data, setData] = useState([]); 12 const [currentData, setCurrentData] = useState([]); 13 14 useEffect(() => { 15 fetchData().then(data => setData(data)); 16 }, []); 17 18 useEffect(() => { 19 setCurrentData(data.slice(offset, offset + pageLimit)); 20 }, [offset, data]); 21 22 return ( 23 <div> 24 <ul> 25 {currentData.map(data => ( 26 <li>{data}</li> 27 ))} 28 </ul> 29 <Paginator 30 totalRecords={data.length} 31 pageLimit={pageLimit} 32 pageNeighbours={2} 33 setOffset={setOffset} 34 currentPage={currentPage} 35 setCurrentPage={setCurrentPage} 36 /> 37 </div> 38 ); 39} 40 41export default App;
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 4
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
17 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More