# rc-hooks

> React Hooks Library.

Latest version **3.4.0** (published 2026-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install rc-hooks
pnpm add rc-hooks
yarn add rc-hooks
bun add rc-hooks
```

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.4.0 |
| Published | 2026-04-23 |
| First published | 2020-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 604.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | caijf |
| Maintainers | caijf |
| Keywords | react, hook |

## Links

- npm: https://www.npmjs.com/package/rc-hooks
- Repository: https://github.com/doly-dev/rc-hooks
- Homepage: https://github.com/doly-dev/hooks#readme
- Issues: https://github.com/doly-dev/hooks/issues
- npm.io page: https://npm.io/package/rc-hooks

## Dependencies (4)

- [ut2](https://npm.io/package/ut2.md) ^1.21.5
- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [cache2](https://npm.io/package/cache2.md) ^3.1.4
- [util-helpers](https://npm.io/package/util-helpers.md) ^5.8.0

## 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

- 3.4.0 (latest) — 2026-04-23
- 3.3.1 — 2026-04-09
- 3.3.0 — 2026-01-28
- 3.2.2 — 2026-01-09
- 3.2.1 — 2026-01-08
- 3.2.0 — 2025-12-04
- 3.1.2 — 2025-12-03
- 3.1.1 — 2025-12-03
- 3.1.0 — 2025-09-09
- 3.0.25 — 2025-08-18
- 3.0.24 — 2025-08-01
- 3.0.23 — 2025-07-10
- 3.0.22 — 2025-04-14
- 3.0.21 — 2025-04-08
- 3.0.20 — 2025-03-27
- … 84 more at https://npm.io/package/rc-hooks/versions

## README

# rc-hooks

[![npm][npm]][npm-url] ![GitHub](https://img.shields.io/github/license/doly-dev/rc-hooks.svg)

React Hooks Library.

[查看文档和示例][site]

## 安装

```shell
npm install rc-hooks
```

```shell
yarn add rc-hooks
```

```shell
pnpm add rc-hooks
```

## 使用

```javascript
import { useAsync } from 'rc-hooks';
```

## API

- Async
  - [useAsync] - 管理异步函数
  - [useLoadMore] - 管理加载更多
  - [usePagination] - 管理分页
- SideEffect
  - [useDebounce] - 用来处理防抖值
  - [useDebounceFn] - 用来处理防抖函数
  - [useThrottle] - 用来处理节流值
  - [useThrottleFn] - 用来处理节流函数
- State
  - [useCacheState] - 管理缓存 state
  - [useLatest] - 返回最新的 state 或 props
  - [useLimitList] - 管理列表展示数量
  - [useSetState] - 管理 object 类型 state ，和 class 组件的 `this.setState` 基本一致
  - [usePrevious] - 返回上一次的 state 或 props
  - [useSafeState] - 安全状态，组件卸载后 setState 不再执行
- LifeCycle
  - [useMount] - 只在组件 mount 时执行
  - [useMountedRef] - 用于异步回调或 dom 操作中判断当前组件是否装载
  - [useUpdate] - 强制组件重新渲染
  - [useUnmount] - 只在组件 unmount 时执行
  - [useUnmountedRef] - 用于判断当前组件是否卸载
  - [useUpdateEffect] - 只在依赖更新时执行的 useEffect
  - [useUpdateLayoutEffect] - 只在依赖更新时执行的 useLayoutEffect
- Other
  - [useClickAway] - 管理目标元素外的事件
  - [useControllableValue] - 便于管理 `受控/非受控` 状态
  - [useFullscreen] - 全屏管理
  - [usePersistFn] - 持久化 function
  - [useSize] - 获取并监听 dom 节点的宽高

[site]: https://doly-dev.github.io/rc-hooks/latest/index.html
[useasync]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-async
[useloadmore]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-load-more
[usepagination]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-pagination
[usedebounce]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-debounce
[usethrottle]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-throttle
[usedebouncefn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-debounce-fn
[usethrottlefn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-throttle-fn
[usesetstate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-set-state
[useprevious]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-previous
[usesafestate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-safe-state
[usecachestate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-cache-state
[uselatest]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-latest
[uselimitlist]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-limit-list
[usemount]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-mount
[usemountedref]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-mounted-ref
[useupdate]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-update
[useunmount]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-unmount
[useunmountedref]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-unmounted-ref
[useupdateeffect]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-update-effect
[useupdatelayouteffect]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-update-layout-effect
[usepersistfn]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-persist-fn
[useclickaway]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-click-away
[usesize]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-size
[usecontrollablevalue]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-controllable-value
[usefullscreen]: https://doly-dev.github.io/rc-hooks/latest/index.html#/hooks/use-fullscreen
[npm]: https://img.shields.io/npm/v/rc-hooks.svg
[npm-url]: https://npmjs.com/package/rc-hooks

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