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 hookcnTip
You can then run commands using hookcn, hcn, or use-hook-cli.
npx hookcn initThis 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 listInstall a hook by name:
npx hookcn add <hook-name>The hook will be copied into the directory defined in hooks.json (default: src/hooks/).
Tip
Now, you can install multiple hooks using a single command.
npx hookcn add useTheme useScroll useCopyToClipboard [more...]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.
