ahooks

Manage React state with grouped updates and localStorage persistence using ahooks hooks.

88|11|Updated Apr 28, 2020
One-click install
npx skills add https://github.com/blockmatic/basilic --skill ahooks-blockmatic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ahooks
Source: https://github.com/blockmatic/basilic/tree/main/.cursor/skills/ahooks-v3
Command: npx skills add https://github.com/blockmatic/basilic --skill ahooks-blockmatic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Abstract state management patterns for React apps using ahooks v3+ hooks, focusing on grouped updates and localStorage persistence to keep UI state coherent across components and sessions.

Core Features & Use Cases

  • Grouped state updates: useSetState to manage multiple fields that update together.
  • LocalStorage persistence: useLocalStorageState to persist user preferences and UI state.
  • Complementary patterns: integrates with URL state patterns or async strategies when needed (e.g., using nuqs or TanStack Query for map- or data-driven state, respectively).

Quick Start

Install and import useSetState and useLocalStorageState to immediately manage a form and save preferences.

Frequently Asked Questions about ahooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage grouped state updates in React forms without missing fields?

Persist React state across sessions using the useLocalStorageState hook to save user preferences and UI state to the browser. It automatically synchronizes state components and survives page reloads.

Does ahooks work with TypeScript for type-safe React state management?

ahooks works with TypeScript for type-safe React state management by enforcing strict typing on useSetState and useLocalStorageState patterns. It requires React 18+ and ahooks v3+ to function properly.

What is the best way to keep React UI state coherent across components and sessions?

The best way to keep React UI state coherent is combining useSetState for synchronized grouped updates and useLocalStorageState for browser persistence. This maintains state alignment across components and reloads.

Can I integrate ahooks with URL state patterns or async data fetching strategies?

ahooks integrates with URL state patterns or async strategies by combining useSetState with complementary tools like nuqs for URL state or TanStack Query for data-driven state to manage complex UI workflows.