Thanks for taking the time to improve React Hooks Library. This guide covers the basic workflow for local development and pull requests.
This repository uses Yarn workspaces. The lockfile is for Yarn classic.
corepack yarn install --frozen-lockfileThe current CI runs on Node 16. If you are using a newer Node version and hit old Next.js or Rollup tooling errors, retry the same command on Node 16 before debugging the change itself.
Run the documentation site:
NODE_OPTIONS=--openssl-legacy-provider corepack yarn website:devRun tests:
corepack yarn test --runInBandRun lint:
corepack yarn lintBuild packages:
corepack yarn build:fullOn Node 17 or newer, the Next.js website build may require the OpenSSL compatibility flag:
NODE_OPTIONS=--openssl-legacy-provider corepack yarn website:buildHooks live in packages/core/<hook-name>. A complete hook directory usually
contains:
index.tsfor the implementationdocs.mdxfor documentation and metadatademo.tsxfor the documentation playgroundindex.test.tswhen behavior can be covered in Jest
Use packages/core/_template as a starting point for a new hook.
When adding a hook, run the full build once. The build script regenerates package entry points before Rollup runs.
Each docs.mdx file needs frontmatter with:
---
category: state
name: useExample
description: Short description of the hook
---Include a usage example, type declaration, and <Source name="..." pkg="core" />
at the bottom of the page.
Keep pull requests focused on one bug, hook, or documentation improvement. Before opening a PR, run the checks that match the change:
- Code changes: tests and lint
- Hook API changes: package build
- Documentation changes: website build when the page rendering changes
Mention any known tooling warnings in the PR if they are unrelated to the change.
Releases are handled by the maintainers. The release script bumps package
versions, creates a commit and tag, and publishes packages from generated dist
folders.