ahooks
Comprehensive ahooks React hooks library specialist. Expert in all 76+ ahooks hooks including state management, effects, data fetching, performance optimization, DOM utilities, and advanced patterns. Use when working with ahooks library, need React hooks utilities or want to learn best practices.
What this skill does
# Ahooks React Hooks Library
This skill provides comprehensive expertise for the ahooks React hooks library, covering all 76+ hooks with detailed documentation, examples, and best practices.
## Quick Start
### Basic Usage
```jsx
import { useRequest, useMount, useSetState } from 'ahooks';
const MyComponent = () => {
const { data, loading, error } = useRequest('/api/data');
const [state, setState] = useSetState({ count: 0 });
useMount(() => {
console.log('Component mounted');
});
return <div>{data}</div>;
};
```
### Common Patterns
- **State Management**: `useSetState`, `useToggle`, `useBoolean` for complex state
- **Data Fetching**: `useRequest` for API calls with caching, retry, polling
- **Performance**: `useDebounce`, `useThrottle` for optimization
- **Lifecycle**: `useMount`, `useUnmount`, `useUpdateEffect` for component lifecycle
## Hook Categories
This skill organizes hooks into 9 main categories:
### ๐ State Management (12 hooks)
State utilities for complex state handling.
**See:** [state-hooks.md](references/state-hooks.md)
### ๐ Lifecycle Effects (9 hooks)
Component lifecycle and effect management.
**See:** [effect-hooks.md](references/effect-hooks.md)
### ๐ Data Fetching (6 hooks)
API calls, pagination, infinite scroll, and data caching.
**See:** [request-hooks.md](references/request-hooks.md)
### โก Performance Optimization (9 hooks)
Debounce, throttle, memoization, and RAF optimizations.
**See:** [performance-hooks.md](references/performance-hooks.md)
### ๐จ DOM & UI (12 hooks)
Event listeners, sizing, scrolling, and UI interactions.
**See:** [dom-hooks.md](references/dom-hooks.md)
### ๐พ Storage (4 hooks)
Local storage, session storage, cookies, and URL state.
**See:** [dom-hooks.md](references/dom-hooks.md)
### ๐ Browser APIs (8 hooks)
Network status, visibility, keyboard events, and browser features.
**See:** [dom-hooks.md](references/dom-hooks.md)
### โฐ Timers (4 hooks)
Intervals, timeouts, and countdown utilities.
**See:** [advanced-hooks.md](references/advanced-hooks.md)
### ๐ Advanced Utilities (12 hooks)
WebSockets, history management, reactive data, and complex patterns.
**See:** [advanced-hooks.md](references/advanced-hooks.md)
## Getting Help
### Ask About:
- **Hook Usage**: "How to use useRequest with pagination?"
- **Migration**: "How to migrate from useState to useSetState?"
- **Best Practices**: "Performance tips for React hooks?"
- **Integration**: "How to combine useRequest with useAntdTable?"
- **Troubleshooting**: "Why is my useDebounce not working?"
- **TypeScript**: "Type definitions for useBoolean?"
### Comprehensive Guides
- [Migration Guide](references/migration-guide.md) - From React built-ins
- [Best Practices](references/best-practices.md) - Performance and patterns
## Quick Reference
```javascript
// Most commonly used hooks
import {
useRequest, // Data fetching
useMount, // Component mount
useUnmount, // Component unmount
useSetState, // State management
useDebounce, // Performance
useThrottle, // Performance
useEventListener // DOM events
} from 'ahooks';
```Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4โv5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.