rabbithook
v2.0.2
Published
Add hooks to your apps.
Downloads
15
Readme
Welcome to Rabbithook! This is a React hook library inspired by the Shadcn architecture, but designed specifically for managing and adding hooks to your React projects. Rabbithook provides a simple command-line interface to initialize, add, and list available hooks, making it easy to quickly integrate functionality into your React applications.
Getting Started
To start using Rabbithook in your React project, follow these steps:
- Ensure you have a React project set up. If not, create one with
create-react-appor your preferred method. - Open a terminal in your project directory.
- Run the following command to initialize Rabbithook:
npx rabbithook@latest initThis command creates a configuration file that Rabbithook uses to determine where to add hooks and other settings.
Available Commands
Rabbithook provides three main commands to interact with your project:
add <...hooks>
The add command allows you to add one or more hooks to your project. To use it, specify the hooks you want to add. For example, to add useFetch and useEventListener, run:
npx rabbithook@latest add useFetch useEventListenerRabbithook will download the requested hooks, handle any required dependencies, and add them to your project.
init
The init command initializes the configuration file for Rabbithook in your project. This command should be run before adding any hooks. It sets up the necessary paths and other configuration options.
npx rabbithook@latest initlist
The list command displays a list of all available hooks that you can add to your project. To see all available hooks, run:
npx rabbithook@latest listExample Usage
Here is an example workflow using Rabbithook:
- Initialize Rabbithook: Run
npx rabbithook@latest initto create the configuration file. - List Available Hooks: Use
npx rabbithook@latest listto see the hooks you can add to your project. - Add Hooks: Add desired hooks to your project with
npx rabbithook@latest add <hook1> <hook2> .... For example, to adduseWindowSizeanduseOnlineStatus, runnpx rabbithook@latest add useWindowSize useOnlineStatus.
