1.0.4 • Published 2 years ago

react-page-states v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-page-states

React hook for bundling typical states used in table pagination

NPM JavaScript Style Guide

Install

npm install --save react-page-states
or
yarn add react-page-states

Features

  • pageNo and pageSize saved in url search params to handle page refresh

Usage

Import the library and use the hook:

import * as React from 'react'
import { usePage } from 'react-page-states'

const Example = () => {
  const { pageNo, pageSize, total, setPageNo, setPageSize } = usePage();
}

API

PropertyTypeDefaultDescription
pageNonumber1Page number.
pageSizenumber10Page size.
totalnumber0Used for computing max allowable pages.
maxPagenumber0Auto computed based on page size and total items.
setPageNo() => voidSets page number value
setPageSize() => voidSets page size value
setTotal() => voidSets total value

License

MIT © raphElzr


1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago