0.0.1 ā€¢ Published 5 years ago

react-pagination-hook v0.0.1

Weekly downloads
366
License
MIT
Repository
github
Last release
5 years ago

A React hook that helps you render a paginator (with TypeScript support)

šŸ  See a demo

Prerequisites

  • react >=16.8.0

Install

npm install react-pagination-hook --save

API

The hook returns the following object:

{
  activePage: number;
  isFirst: boolean;
  isLast: boolean;
  hasPrevious: boolean;
  hasNext: boolean;
  visiblePieces: PaginatorPiece[];
  goToPage: (pageNumber: number) => void;
}

And a PaginatorPiece is either of the following objects:

{ type: 'previous', pageNumber: number, isDisabled: boolean }
// or
{ type: 'next', pageNumber: number, isDisabled: boolean }
// or
{ type: 'page-number', pageNumber: number }
// or
{ type: 'ellipsis' }

Usage

You can use this hook to develop your own pagination component. Check out the demo

Author

šŸ‘¤ Eliseu dos Santos <eliseumds@gmail.com>

šŸ¤ Contributing

Contributions, issues and feature requests are welcome !Feel free to check issues page.

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2019 Eliseu dos Santos <eliseumds@gmail.com>. This project is MIT licensed.


This project was bootstraped with typescript-library-starter

This README was generated with ā¤ļø by readme-md-generator