Repository navigation
Adding a New Hook
github-actions[bot] edited this page Oct 14, 2026
·
2 revisions
Follow this checklist when contributing a hook. Full contributor notes live in CONTRIBUTING.md.
- Create
src/hooks/useYourHook.ts(or.tsx) with a named export. - Re-export it from
src/index.ts. - Add
src/hooks/useYourHook.test.ts(or.tsx) co-located with the hook. - Keep the hook file under 150 lines, TypeScript-strict, no new runtime dependency unless required.
- Document the hook in the README hook tables (link to
https://usethishook.mentorbridge.in/useYourHook).
Add all of:
- Catalog entry in
stateHooks.ts,browserHooks.ts,appHooks.ts, orleverageHooks.ts - Description in
playground/src/descriptions/ - API spec in
playground/src/api/ - Demo component and copy-paste example in
playground/src/demos/
Optional: set tags: ['New'] on the catalog entry so the playground nav and browse cards show a New badge (clear the tag in a later release when the hook is no longer new).
npm run playground:seo picks up new src/hooks/use*.ts(x) files for the sitemap automatically on the next playground build.
npm run verify:commit # secrets, lint, types, coverage, library build
npm run verify:push # playground build + npm audit (high+)Husky runs these on commit / push. Node 20+ (engines.node).
Use the PR template: include tests, playground updates, and README / CHANGELOG when the public API changes.