# @szsk/react-utils

> common react utils

Latest version **0.3.0** (published 2023-11-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install @szsk/react-utils
pnpm add @szsk/react-utils
yarn add @szsk/react-utils
bun add @szsk/react-utils
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2023-11-09 |
| First published | 2023-07-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | qhchen01@163.com |
| Maintainers | qhchen |
| Keywords | hook, react hook, react functions, react方法 |

## Links

- npm: https://www.npmjs.com/package/@szsk/react-utils
- Repository: https://github.com/yunnan-tibet/react-utils
- Homepage: https://github.com/yunnan-tibet/react-utils#readme
- Issues: https://github.com/yunnan-tibet/react-utils/issues
- npm.io page: https://npm.io/package/@szsk/react-utils

## Dependencies (1)

- [core-js](https://npm.io/package/core-js.md) ~2.6.10

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2023-11-09
- 0.2.1 — 2023-08-02
- 0.2.0 — 2023-08-02
- 0.1.0 — 2023-08-02
- 0.0.1 — 2023-07-15

## README

# szsk前端react函数库
目前主要用于集中记录项目中使用到的hook

## 使用范围
react > 16.9.0

## 使用方式
npm i @szsk/react-utils

import { hookUtils } from '@szsk/react-utils';

ts使用
```
  // tsconfig.json
  "compilerOptions": {
    "typeRoots": [
      // 加入这个进行自动提示
      "node_modules/@szsk",
    ]
  },
```

### hook
```
/**
 * 节流，先执行一次
 * @param {Function} fn 
 * @param {number} delay 毫秒
 * @returns {Function} 
 */
export const useThrottle = (fn: Function, delay: number)

/**
 * 节流，阶段时间结束执行一次
 * 举例：
 *    用于scroll监听
 * @param {Function} fn 
 * @param {number} delay 毫秒
 * @returns {Function} 
 */
export const useThrottleAtLast = (fn: Function, delay: number)

/**
 * 防抖，等待时间结束再执行
 * @param {Function} fn 
 * @param {number} delay 毫秒
 * @returns {Function} 
 */
export const useDebounce = (fn: Function, delay: number)

/**
 * 防抖，先执行一次
 * @param {Function} fn 
 * @param {number} delay 毫秒
 * @returns {Function} 
 */
export const useDebounceAtOnce = (fn: Function, delay: number)
```

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