Hooks
@rhinolabs/react-hooks is a collection of 30+ production-ready React hooks that solve common web development challenges. These hooks help you manage state, handle side effects, and implement complex functionality with ease.
Installation
# Using npm
npm install @rhinolabs/react-hooks
# Using pnpm
pnpm add @rhinolabs/react-hooks
# Using yarn
yarn add @rhinolabs/react-hooks
Available Hooks
State & Storage
useArray
- Array manipulation with built-in CRUD operationsuseLocalStorage
- Persistent state in localStorageuseToggle
- Boolean state managementusePrevious
- Access previous state valuesuseInput
- Form input state handling
Performance & Optimization
useDebounce
- Delay state updates for performanceuseFirstRender
- First render detectionuseScript
- Dynamic script loadinguseEventListener
- Optimized event handling
Browser & DOM
useTitle
- Document title managementuseFavicon
- Dynamic favicon updatesuseWindowSize
- Window dimensions trackinguseScroll
- Scroll position monitoringuseOnScreen
- Intersection observationuseOutsideClick
- Click outside detectionuseKeyPress
- Keyboard event handling
Media & Files
useAudio
- Audio playback controluseVideo
- Video playback controluseDownload
- File download handlinguseClipboard
- Copy/paste operations
Network & Data
useFetch
- Data fetching with statesuseAsync
- Async operation handlinguseSearchParams
- URL parameter managementuseOffline
- Network status detectionuseNavigatorShare
- Web Share API
Device & Sensors
useGeolocation
- Location trackinguseIsTouchDevice
- Touch capability detectionuseBattery
- Battery status monitoringuseLang
- Language detectionuseFirstVisit
- First visit detection
Time & Timers
useCountdown
- Countdown timeruseCountup
- Count-up timeruseStopwatch
- Stopwatch functionalityuseTimer
- General purpose timer
Utilities
useRandomColor
- Random color generation
Benefits
- Type Safety: Full TypeScript support with comprehensive type definitions
- Tree Shakeable: Only import what you need, keeping your bundle size minimal
- Well Tested: Thoroughly tested hooks for production use
- Zero Dependencies: No external runtime dependencies
- Easy to Use: Simple, consistent API across all hooks
Last updated on