@saurssaurav/pagination-js-react
v2.1.0-dev.0
Published
Simple and light weight pagination for react.
Downloads
1
Readme
Pagination React
Simple and light weight pagination for react.
Installation
$ npm i @saurssaurav/pagination-js-react
Usage
import { useState } from 'react';
import PaginationTest from '@saurssaurav/pagination-js-react';
import '@saurssaurav/pagination-js-core/style.css';
function App() {
const [currentPage, setCurrentPage] = useState(1);
const onChange = (page:number) => {
setCurrentPage(page);
};
return (
<>
<PaginationTest
totalPage={10}
pageSidesToCurrentPage={1}
currentPage={currentPage}
onChangeCurrentPage={onChange}
></PaginationTest>
</>
);
}
export default App;
Props
| Name | Type | Default | Description |
| ------------------------ | -------- | ------- | -------------------------------------------------------------------- |
| totalSize
| Number | | Required. Total data size |
| currentPage
| Number | | Required. Active page number |
| onChangeCurrentPage
| Function | | Required. Page change handler. Receive current pageNumber as arg |
| pageSidesToCurrentPage
| Number | | Required. Neighbouring pages to active page |