Skip to content
On this page

Installation

One package, no setup step.

Add the package

sh
pnpm add better-hooks

The same package is available through npm and other package managers. Published versions and release metadata live on the npm package page.

Choose an import

Use a direct entry when you want the dependency to be obvious:

ts
import { useToggle } from 'better-hooks/use-toggle';

The root entry is also supported when a module uses several Hooks:

ts
import { useDebounce, useToggle } from 'better-hooks';

Both styles are typed ESM imports. The package declares sideEffects: false, so the choice is mostly about clarity and the module graph your bundler sees first.

Check the requirements

RequirementSupported range
React>=19.0.0 <20.0.0
Node.js for development and builds^22.18.0 or >=24.11.0
Module formatESM only

The repository pins Node.js 24.20.0 for development, CI, and releases while retaining 22.18.0 as the minimum compatibility lane. React is a peer dependency. Better Hooks has no other runtime dependency.

Continue with Getting started, or scan the latest changes in the Changelog.