# @trz/hooks

> 一个 React Hooks 工具集

Latest version **6.7.5** (published 2023-01-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install @trz/hooks
pnpm add @trz/hooks
yarn add @trz/hooks
bun add @trz/hooks
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.7.5 |
| Published | 2023-01-05 |
| First published | 2022-04-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ZHENYUAN |
| Maintainers | chenzhenyuan |

## Links

- npm: https://www.npmjs.com/package/@trz/hooks
- Homepage: https://chenzhenyuan.com
- Issues: https://chenzhenyuan.com/trz/bugs
- npm.io page: https://npm.io/package/@trz/hooks

## Dependencies (1)

- [@trz/type](https://npm.io/package/@trz/type.md) ^0.5.0

## Recent versions

- 6.7.5 (latest) — 2023-01-05
- 7.0.0-beta.3 (beta) — 2022-11-25
- 6.7.3 — 2022-11-30
- 6.7.2 — 2022-11-30
- 6.7.1 — 2022-11-25
- 6.7.0 — 2022-11-25
- 7.0.0-beta.2 — 2022-11-25
- 7.0.0-beta.1 — 2022-11-25
- 7.0.0-beta.0 — 2022-11-17
- 6.6.8 — 2022-08-20
- 6.6.7 — 2022-08-18
- 6.6.6 — 2022-08-18
- 6.0.2 — 2022-05-10
- 6.0.1 — 2022-05-09
- 5.2.7 — 2022-04-19
- … 3 more at https://npm.io/package/@trz/hooks/versions

## README

# `@trz/hooks`

> A magical utils 😂

## Usage

```tsx
import { useHistory } from 'react-router';
import { useQueries } from "@trz/hooks";

/* -------------------------------------------------------------------------- */
// App.tsx
function TestComponent(): ReactElement {
  const [ queries, setQueries ] = useQueries({ pageSize: 10, pageNo: 1 });
  
  const _clickHandler = useCallback(() => {
    setQueries((queries) => {
      return { ...queries, pageNo: 2};
    });
    //Redirect => /index?pageNo=2&pageSize=10
  }, [])
  
  useLayoutEffect(() => {
    console.log(queries.pageSize, queries.pageNo);
    //print => 10 1
  }, [ queries ]);
  
  
  return (
    <Some.Component>
      <Link to={`/index?pageNo=${queries.pageNo - 1}&pageSize=${queries.pageSize}`}>Prev</Link>
      <Link to={`/index?pageNo=${queries.pageNo + 1}&pageSize=${queries.pageSize}`}>Next</Link>
      
      <Button
        onClick={() => {
          setQueries({ pageNo: 2 });
          //Redirect => /index?pageNo=2
        }}>
        Click me
      </Button>
      
      <Button
        onClick={_clickHandler}>
        Click me
      </Button>
    </<Some.Component>>
  );
}
```

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