Miss any of our Open RFC calls?Watch the recordings here! »

use-pagination

1.0.6 • Public • Published

use-pagination

React hook for data pagination

NPM JavaScript Style Guide

Install

npm install --save use-pagination

Usage

import * as React from 'react'
 
import usePagination from 'use-pagination'
 
const App = () => {
  const pagination = usePagination({
    items: [1, 2, 3, 4, 5],
    itemsPerPage: 2,
  });
 
  return (
    <div>
      <pre>
        { JSON.stringify(pagination, null, 2 )}
      </pre>
      <button onClick={pagination.onNextPage}>Next</button>
      <button onClick={pagination.onPreviousPage}>Back</button>
      <button onClick={pagination.onResetPage}>Reset</button>
    </div>
  )
}

License

MIT ©


This hook is created using create-react-hook.

Install

npm i use-pagination

DownloadsWeekly Downloads

6

Version

1.0.6

License

MIT

Unpacked Size

1.05 MB

Total Files

25

Last publish

Collaborators

  • avatar