Publish a hook
Step by step guide on how to build and publish your own hook
01
Fork and clone the repo
Fork the repo, clone it locally, and install dependencies.
Run$ git clone <your-fork-url> && cd hooks && pnpm install02
Create a branch
Create a focused branch for your hook.
Run$ git checkout -b feat/use-my-hook03
Run the hook generator
Run$ pnpm create:hookpnpm create:hook?Hook name›useClipboard?Framework support›React, Vue, or both?GitHub username›optional04
Let the generator scaffold it
It checks name availability, and creates everything below. It also updates the package exports and regenerates the docs registry.
use-clipboard/ ├── core.ts ├── react.ts ├── vue.ts ├── meta.ts ├── hook.test.ts └── examples/ ├── react.tsx └── vue.vue05
Implement the hook
Steps to implement the hook
- Hook namerequired
- Use the public API name, like useOnline, useClipboard, or useLocalStorage.
- Core logicrequired
- Write the actual behavior in core.ts when there's logic shared across frameworks.
- Framework implementationrequired
- Add the hook to react.ts, vue.ts, or both.
- Usage examplerequired
- Replace the placeholder with real usage code for each framework you support.
- Description and Tests
- Update description and overwrite auto-generated tests if required
06
Run full check
Run$ pnpm check07
Commit and create a PR
Run$ git commit -m "feat(clipboard): add useClipboard"