# react-page-states

> React hook for bundling typical states used in table pagination

Latest version **1.0.4** (published 2022-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-page-states
pnpm add react-page-states
yarn add react-page-states
bun add react-page-states
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-03-12 |
| First published | 2022-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 533.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | raphElzr |
| Maintainers | raphfuentes |

## Links

- npm: https://www.npmjs.com/package/react-page-states
- Repository: https://github.com/raphElzr/react-page-states
- Homepage: https://github.com/raphElzr/react-page-states#readme
- Issues: https://github.com/raphElzr/react-page-states/issues
- npm.io page: https://npm.io/package/react-page-states

## Recent versions

- 1.0.4 (latest) — 2022-03-12
- 1.0.3 — 2022-02-04
- 1.0.2 — 2022-02-03
- 1.0.1 — 2022-02-03
- 1.0.0 — 2022-02-03

## README

# react-page-states

> React hook for bundling typical states used in table pagination

[![NPM](https://img.shields.io/npm/v/react-page-states.svg)](https://www.npmjs.com/package/react-page-states) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
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:
```tsx
import * as React from 'react'
import { usePage } from 'react-page-states'

const Example = () => {
  const { pageNo, pageSize, total, setPageNo, setPageSize } = usePage();
}
```
## API
| Property | Type | Default | Description
| ------------- |---------------------- | ----|----------------------------------------------------------------------- | 
| `pageNo`      | `number`              | `1` | Page number.                                                           |
| `pageSize`    | `number`              | `10`| Page size.                                                             |
| `total`       | `number`              | `0` | Used for computing max allowable pages.                                |
| `maxPage`     | `number`              | `0` | Auto computed based on page size and total items.                      |
| `setPageNo`   | `() => void`          |     | Sets page number value                                                 |    
| `setPageSize` | `() => void`          |     | Sets page size value                                                   |       
| `setTotal`    | `() => void`          |     | Sets total value                                                       |                  

## License

MIT © [raphElzr](https://github.com/raphElzr)

---

---
_Source: https://npm.io/package/react-page-states · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
