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 dependencies from the root of the repo (Node
24.xandpnpm@11are recommended):
pnpm installNote: this is a pnpm workspace (monorepo). The command installs dependencies for all packages under
packages/*.
- build the package you are editing using its workspace filter from the root of the repo:
pnpm --filter <PACKAGE_NAME> run buildReplace <PACKAGE_NAME> with the relevant package name. The main packages are:
@siberiacancode/reactuseβ the core hook library (packages/hooks)@siberiacancode/docsβ the documentation site (packages/docs)@siberiacancode/cli/useverseβ the CLI for adding hooks (packages/cli)
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 (a
husky+lint-stagedpre-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 hooks package, named exactly after the hook (e.g.
useCounter/) - a hook directory should contain:
- the hook implementation (
useCounter.ts) - tests (
useCounter.test.ts) - a demo/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
window/documentat 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 --filter <PACKAGE_NAME> add <LIBRARY>If you're building an adapter around a particular library, add it as a peer dependency:
pnpm --filter <PACKAGE_NAME> add --save-peer <LIBRARY>