A powerful CLI to manage and install reusable React custom hooks from a centralized GitHub repository.
🌐 Hosted at: openhooks.is-a.dev
open-hook is a CLI tool designed to simplify the process of managing custom React hooks. It allows you to:
- 🔍 List available hooks
- 📥 Install one or more hooks into your project
- ⚙️ Initialize your configuration
- 🛠️ Choose between JavaScript or TypeScript
- 🪝 Automatically update
hooks/manifest.jsonfor shared metadata
.
├── cli/ # CLI source code (Node + TypeScript)
├── hooks/ # Public hook repository
│ ├── js/ # JavaScript hooks
│ ├── ts/ # TypeScript hooks
│ └── manifest.json
├── docs/ # Optional documentation site (e.g., Docusaurus, VitePress, etc.)
├── .github/ # GitHub workflows, templates, CODEOWNERS
├── README.md # You are here
└── package.json
npm install -g open-hookOr with pnpm:
pnpm add -g open-hookopen-hook initYou'll be prompted to set:
- Hook installation directory (e.g.,
src/hooks) - Preferred language (
jsorts)
open-hook add
# or
open-hook add useDebounce useClickOutside --language tsopen-hook listYou can explore available hooks and their documentation in the docs/ folder or at the hosted site openhooks.is-a.dev.
We welcome contributions from the community!
Please read our CONTRIBUTING.md before submitting a pull request.
- Create the hook inside
hooks/js/orhooks/ts/ - Update
hooks/manifest.json - Test with:
open-hook add useMyNewHook
- Open a PR using the PR Template
This project is maintained by:
If you find this project useful, please consider giving it a ⭐️ and sharing it with others.
This document lists available, planned, and suggested hooks for a comprehensive React hooks library.
useDebounceuseLocalStorageusePrevioususeTimeout
useClickOutsideuseClipboard
useLocationuseMobile
Total available hooks: 9
useStateWithHistoryuseFetchuseThrottleuseArrayStateuseMapStateuseQueueStateuseUndoRedoStateuseTimeTravelStateuseSafeSetStateuseToggleuseCounterusePromiseusePreviousImmediateusePreviousDifferent
useClickOutsideuseClipboarduseKeyPressuseHoveruseOnWindowResizeuseOnWindowScrolluseOnLongPressuseOnStartTypinguseFocusWithinuseDocumentEventListeneruseFocususeIsDroppingFilesuseOutsideClickuseOnHoverRef
useLocationuseMobileuseGeolocationuseOnlineuseIdleuseSpeechRecognitionuseVibrateuseWebSocketuseMediaQueryuseIntersectionObserveruseResizeObserveruseMutationObserveruseFullscreenusePictureInPictureApiuseScreenDetailsApi
useDebouncedValueuseThrottleFnuseRafuseIsMounteduseLifecycleLoggeruseDeepCompareEffectuseMemoizedCallbackuseRenderCountuseWhyDidYouUpdateuseSafeSetStateuseAsyncEffectuseEffectOnceWhen
useFocusTrapuseAriaLiveuseSkipToContentuseAccessibleDropdownuseAccessibleTabsuseAccessibleModaluseAccessibleTooltipuseAccessibleAccordionuseAccessibleCarouseluseAccessibleDialog
useEventListeneruseForkRefuseFreshCallbackuseFreshRefuseMergeRefsuseRefElementuseDimensionsuseBoundingClientRectuseMutationObserveruseResizeObserveruseFreshTickuseMergeRefs
useDidMountuseDidUpdateuseWillUnmountuseIsomorphicEffectuseEffectOnceuseEffectWhen
Total planned hooks: 85
useFormState– General-purpose form state managementusePersistentState– State persisted in IndexedDB or sessionStorageuseAsyncState– Automatically manage promises in stateuseComputedState– Derived state based on other statesuseBroadcastState– Sync state across multiple tabs/windows
useDrag/useDrop– Drag & drop functionalityuseSwipe– Detect swipe gesturesuseShortcut– Keyboard shortcut manageruseMousePosition– Track cursor positionusePointerLock– Pointer lock API for interactive apps
useBattery– Monitor battery statususeDeviceOrientation– Detect device tilt/rotationuseAmbientLight– Detect light levels for dark mode triggersuseClipboardHistory– Track clipboard changes over time
useIdleCallback– Run code during browser idle timeuseWebWorker– Offload heavy computationsuseProfiler– Profile component render timesuseRenderDebounce– Debounce re-renders for heavy components
useKeyboardNavigation– Arrow/tab navigation for custom UIsuseScreenReaderStatus– Detect active screen readersuseFocusVisible– Track focus-visible state
useErrorBoundary– Catch component errors gracefullyuseLogger– Log state or props changesuseUniqueId– Generate unique IDs (useful for accessibility)useLocalForage– Persistent state using IndexedDBuseAsyncQueue– Queue async tasks with concurrency control
usePageVisibility– Detect if page/tab is visibleuseNetworkStatus– Online/offline detectionuseUpdateEffect– LikeuseEffect, skips first renderuseDeepEffect– Deep compare dependencies before triggering effect
| Category | Available | Planned | Suggested | Total |
|---|---|---|---|---|
| State Management | 4 | 16 | 5 | 25 |
| Event Handling | 2 | 14 | 5 | 21 |
| Device & Browser | 2 | 15 | 4 | 21 |
| Performance | 0 | 12 | 4 | 16 |
| Accessibility | 0 | 10 | 3 | 13 |
| Utilities | 0 | 12 | 5 | 17 |
| Lifecycle & Effects | 1 | 6 | 4 | 11 |
Grand Total Hooks: 124