A CLI tool that instantly copies React hooks into your codebase.
hookcn started as a personal tool. Now it’s open for everyone. It lets you copy TypeScript React hooks directly into your codebase — no dependencies, full ownership.
Install the CLI globally:
npm install -g hookcn
[!TIP] You can then run commands using
hookcn
,hcn
, oruse-hook-cli
.
npx hookcn init
This creates a hooks.json
file at your project root:
{
"destination": "src/hooks"
}
This tells the CLI where to place downloaded hooks. You can update it anytime.
List available hooks from the registry:
npx hookcn list
Install a hook by name:
npx hookcn add <hook-name>
The hook will be copied into the directory defined in hooks.json
(default: src/hooks/
).
Every hook comes with a markdown file inside the docs/
folder.
You can also explore all available hooks and their documentation online on Gitbook.
Contributions are always welcome — whether it’s new hooks, CLI improvements, or documentation fixes.
Refer to this guide CONTRIBUTING.md for more details.