@mariosant/react-pagination-hook
v0.0.1
Published
Create paginated content with this easy to use React Hook
Downloads
204
Readme
Pagination Hook for React
Create paginated content with this easy to use React Hook
Installation
Add @mariosant/react-pagination-hook
to your package.json
.
$ npm install @mariosant/react-pagination-hook
You can now import the module and use it like
import usePagination from '@mariosant/react-pagination-hook';
const Component = ({data}) => {
const {
nextPage,
previousPage,
paginated,
} = usePagination(data) // data must be an array
return (
<div>
{paginated.map(record => (
<div key={record.key}>{record}</div>
))}
<button onClick={previousPage}>Previous</button>
<button onClick={nextPage}>Next</button>
</div>
)
Usage
WIP
Development
WIP
Meta
Marios Antonoudiou – @marios_ant – [email protected]
Distributed under the MIT license.
https://github.com/mariosant/react-pagination-hook
Contributing
- Fork it (https://github.com/mariosant/react-pagination-hook/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes using a semantic commit message.
- Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request