ahooks

A high-quality, production-tested collection of React hooks

Library
npm
v3.10.0
14,974 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
86 /100 Excellent
Development Activity 80
Maintenance 88
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
79 /100 Good
Architecture 78
Code Quality 82
Innovation 75
Learning Curve 80

ahooks is a large, well-documented library of reusable React hooks covering everything from basic state and lifecycle helpers (useBoolean, useToggle, useMount) to advanced, business-scenario-driven hooks like useRequest (async data fetching with caching, retry, and polling), useDebounce/useThrottle, drag-and-drop, and DOM interaction hooks (useHover, useClickAway, useInViewport).

Maintained by Alibaba and used extensively across its internal products, ahooks is written in TypeScript with predictable static types, supports SSR, and ships bilingual (English/Chinese) documentation with live demos for every hook — making it one of the most comprehensive general-purpose React hooks collections available.

What You Get

  • A broad catalog of basic hooks (useBoolean, useToggle, useCounter, useMap, useSet, useLatest) for everyday component state
  • useRequest, a full-featured async data-fetching hook with caching, deduplication, polling, retry, and pagination built in
  • DOM and browser interaction hooks (useHover, useClickAway, useInViewport, useDrag/useDrop, useEventListener, useMouse)
  • Debounce/throttle hooks (useDebounce, useDebounceFn, useThrottle, useThrottleFn) and effect variants (useDeepCompareEffect, useAsyncEffect)
  • Bilingual documentation (English/Chinese) with a live CodeSandbox demo for every individual hook

Common Use Cases

  • Replacing hand-rolled useEffect/useState boilerplate for data fetching with useRequest’s caching, retry, and polling behavior
  • Adding debounced/throttled input handling to search boxes and forms without reimplementing timer logic
  • Building drag-and-drop or DOM-interaction features (useDrag, useHover, useInViewport) without a separate dependency per behavior
  • Standardizing common component patterns (toggles, counters, maps/sets as state) across a large team’s codebase

Under The Hood

Architecture — ahooks is organized as a pnpm-workspace monorepo (packages/hooks, plus split-out packages like @ahooksjs/use-url-state) where every hook lives in its own directory under packages/hooks/src/<hookName>/ with a co-located index.ts, __tests__/, demo/, and bilingual markdown docs. This one-hook-per-folder layout keeps each hook independently documented and testable while still being re-exported from a single top-level index.ts barrel file for the published ahooks package.

Tech Stack — Nearly 100% TypeScript, built and bundled for CJS (lib/), ESM (es/), and a UMD unpkg build (dist/ahooks.js), with sideEffects: false set for tree-shaking. useRequest in particular is architected as a plugin-based hook internally, composing smaller behaviors (cache, polling, retry, debounce) as independent plugins layered onto a base fetch hook.

Code Quality — Every hook directory ships its own __tests__ folder, and coverage is tracked via Coveralls (visible in the README badge). Consistent structure across ~80 hooks (test + demo + doc per hook) makes the codebase easy to navigate despite its size, and the top-level index.spec.ts provides an integration-level smoke test across the full public API surface.

API Design — Hooks follow React’s use-prefixed naming convention consistently and are designed to be dropped in with minimal configuration (e.g. useRequest(fetchFn) works out of the box, with options layered on top only when needed). The bilingual per-hook documentation with runnable demos significantly lowers the learning curve for adopting any single hook without needing to understand the whole library.

Used by 12 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 3 weeks ago
TypeScript
50%
Other

Dify

AI Development · Design Tools · Developer Tools

157,364

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
66
Dependency
Built with
TypeScript 50%
Python 47%
Updated 4 days ago
TypeScript
88%
MIT

Drawnix

Design Tools · Productivity

14,848

All-in-one open-source whiteboard combining mind maps, flowcharts, and freehand drawing on a single infinite canvas.

View details
65
Repo Health
69
Technical
79
Dependency
Built with
TypeScript 88%
Updated 3 weeks ago
TypeScript
90%
Other

FastGPT

AI Agents · AI Development

29,758

Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript 90%
Updated 4 days ago
TypeScript
95%
AGPL 3.0

HeyForm

Forms Surveys · No Code Platforms

8,984

Open-source conversational form builder with AI generation, conditional logic, and 30+ integrations — self-host with full data ownership.

View details
83
Repo Health
67
Technical
67
Dependency
Built with
TypeScript 95%
Updated 3 weeks ago
TypeScript
55%
Other

Jaaz

AI Agents · AI Design Tools

6,670

Open-source AI creative agent that turns visual sketches and canvas gestures into images and videos — no text prompts required.

View details
48
Repo Health
59
Technical
71
Dependency
Built with
TypeScript 55%
Python 34%
JavaScript 10%
Updated 7 months ago
TypeScript
98%
MIT

Kimi Code CLI

AI Agents · AI Code Assistants · Developer Tools

7,705

A single-binary, terminal-native coding agent that reads, edits, and runs code end to end, built by Moonshot AI for Kimi models but pluggable with Anthropic, OpenAI, and Google providers too.

View details
82
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 98%
Updated 4 days ago
TypeScript
99%
Other

LobeHub

AI Assistants · Automation · Productivity

82,864

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
66
Dependency
Built with
TypeScript 99%
Updated 4 days ago
TypeScript
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,043

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
70
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers