Note
We prefer English language for all communication.
Thanks for your interest in contributing to reactuse. This document explains how to report issues, set up the project locally, and submit a pull request.
Before creating an issue, please make sure the problem is not already reported.
- Bug report - provide a minimal reproduction using StackBlitz or CodeSandbox, describe expected vs actual behavior, and include your environment (React version, browser, OS).
- Feature request - add a motivation section and a few usage examples showing how the hook or API would be used.
- fork and clone the repository
- create a development branch from
main - install the required tooling:
Node.js 24.xpnpm 11bunfor docs and codegen scripts inpackages/newdocs
- install dependencies from the root of the repo:
pnpm installNote: this is a pnpm workspace (monorepo). The command installs dependencies for all packages under
packages/*.
- build the package you are editing from the root of the repo:
pnpm --dir <PACKAGE_PATH> run buildReplace <PACKAGE_PATH> with the relevant package path. The main packages are:
packages/core- the core hook librarypackages/newdocs- the documentation sitepackages/cli- the CLI for adding hooks
There are also handy shortcuts in the root package.json:
pnpm core:build:js # build the core library
pnpm docs:build # build the documentation site
pnpm cli:build # build the CLI and generate its registry- make changes, then run the checks locally:
pnpm lint # lint all packages
pnpm unit-test # run unit tests across all packages
pnpm format # format with prettier- commit your changes (the
lefthookpre-commit hook will lint and format staged files automatically) - push your feature branch and open a Pull Request targeting
main - link your PR to the issue using a closing keyword or describe the motivation and changes in the comment (example:
fix #74) - wait until a maintainer reviews it
The goal of reactuse is to provide a large set of production-ready, TypeScript-first, SSR-compatible React hooks. Adding a new hook follows the same flow as sending a pull request, plus a few conventions:
- each hook lives in its own directory inside the core package, named exactly after the hook (for example
useCounter/) - a hook directory should contain:
- the hook implementation (
useCounter.ts) - tests (
useCounter.test.ts) - a demo or example component used by the docs
- the hook implementation (
- export the new hook from the package entry point so it ships with the library and is picked up by the CLI registry
- make sure the hook is tree-shakeable and works in SSR (no direct access to
windowordocumentat module load; guard browser APIs inside effects)
After adding a dependency, run pnpm install from the repo root. To add a dependency to a specific package, use:
pnpm --dir <PACKAGE_PATH> add <LIBRARY>If you're building an adapter around a particular library, add it as a peer dependency:
pnpm --dir <PACKAGE_PATH> add --save-peer <LIBRARY>