useHooks.iov4.1.2
DocsBlogGitHub
Hooks
No hooks found in any category.

CLI

v4.1.2

A powerful command-line interface tool for seamlessly integrating React hooks into your projects.

Note: Make sure you have Node.js 18.0 or higher installed. No installation required - use npx to run the CLI directly.

init

Initialize usehooks configuration in your project with smart project detection.

The init command detects your project structure, installs dependencies, adds utility functions, and configures your project.

Usage

npx usehooks-cli@latest init

add

Add hooks and their dependencies to your project.

Usage

npx usehooks-cli@latest add [hooks...]

Arguments

hooks
Name of the hook(s) to add

Options

-y, --yes
Skip confirmation prompt
-o, --overwrite
Overwrite existing files
-c, --cwd <cwd>
The working directory. Defaults to the current directory.
-p, --path <path>
The path to add the hook to

update

Update hooks to their latest versions with automatic backup creation.

Usage

npx usehooks-cli@latest update [hooks...]

Arguments

hooks
Name of the hook(s) to update

Options

-a, --all
Update all installed hooks
-y, --yes
Skip confirmation prompt
-c, --cwd <cwd>
The working directory. Defaults to the current directory.

remove

Remove hooks from your project with smart dependency cleanup.

Usage

npx usehooks-cli@latest remove [hooks...]

Arguments

hooks
Name of the hook(s) to remove

Options

-y, --yes
Skip confirmation prompt
-c, --cwd <cwd>
The working directory. Defaults to the current directory.
--clean-deps
Remove unused dependencies

list

View all available hooks in the registry, organized by category.

Usage

npx usehooks-cli@latest list

search

Search for hooks by name, description, or category with fuzzy matching.

Usage

npx usehooks-cli@latest search <query>

Arguments

query
Search query (required)

Options

-c, --category <category>
Filter by specific category
-i, --interactive
Interactive search mode
-a, --add
Add selected hook after search

info

Get detailed information about a specific hook including examples, dependencies, and methods.

Usage

npx usehooks-cli@latest info <hook-name>

Arguments

hook-name
Name of the hook (required)

Options

-e, --examples
Show only examples
-d, --dependencies
Show only dependencies
-m, --methods
Show only methods

Examples

Here are some common usage examples for the usehooks CLI.

Initialize a new project

Start by initializing your project with the usehooks CLI configuration.

npx usehooks-cli@latest init

Add a specific hook

Add a specific hook to your project, for example use-counter.

npx usehooks-cli@latest add use-counter

Add multiple hooks

You can add multiple hooks at once by specifying them as arguments.

npx usehooks-cli@latest add use-counter use-fetch use-toggle

Search for hooks

Search for hooks by keyword with interactive selection.

npx usehooks-cli@latest search "fetch" --interactive --add

Update all hooks

Keep your hooks up-to-date with the latest versions.

npx usehooks-cli@latest update --all

Get hook information

Get detailed information about a hook before adding it.

npx usehooks-cli@latest info use-fetch

Features

The usehooks CLI comes with powerful features to enhance your development workflow.

🚀 Quick Installation

Add hooks to your project with a single command

🔍 Smart Search

Find hooks by name, description, or category with fuzzy matching

🔄 Update Management

Keep your hooks up-to-date with automatic backup creation

🗑️ Clean Removal

Remove hooks and their dependencies safely

⚡️ Zero Configuration

Works out of the box with smart project detection

🛡️ Type Safe

Full TypeScript support with proper type definitions

Need help?

Run any command with the --help flag to see detailed usage information, or visit the npx usehooks-cli@latest list command to see all available hooks.