Skip to content

Manual Installation

Add reactuse to your project without relying on a framework-specific guide.

Install the package

bash
npm install @siberiacancode/reactuse
bash
yarn add @siberiacancode/reactuse
bash
pnpm add @siberiacancode/reactuse
bash
bun add @siberiacancode/reactuse

Configure path aliases

Add baseUrl and paths to your tsconfig.json (or jsconfig.json) so imports resolve correctly:

json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Adjust the @/* path to match your project structure (e.g. "./*" if you have no src folder).

Run the CLI

Run the useverse init command to setup your project:

bash
npx useverse@latest init

This will create a configuration file reactuse.json in your project and configure where hooks are generated (e.g. @/shared/hooks).

Add hooks

Add hooks to your project with the CLI:

bash
npx useverse@latest add useBoolean

Then import and use them:

tsx
import { useBoolean } from '@/shared/hooks';

const App = () => {
  const [on, toggle] = useBoolean();

  return (
    <div>
      <button type='button' onClick={() => toggle()}>
        Toggle
      </button>
      <p>{on.toString()}</p>
    </div>
  );
};

If you prefer not to use the CLI, you can import hooks directly from the package:

tsx
import { useBoolean } from '@siberiacancode/reactuse';

Released under the MIT License.