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
Section titled “Installation”# Using npmnpm install @rhinolabs/react-hooks
pnpm add @rhinolabs/react-hooks
yarn add @rhinolabs/react-hooksAvailable Hooks
Section titled “Available Hooks”State & Storage
Section titled “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
Section titled “Performance & Optimization”useDebounce- Delay state updates for performanceuseFirstRender- First render detectionuseScript- Dynamic script loadinguseEventListener- Optimized event handling
Browser & DOM
Section titled “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
Section titled “Media & Files”useAudio- Audio playback controluseVideo- Video playback controluseDownload- File download handlinguseClipboard- Copy/paste operations
Network & Data
Section titled “Network & Data”useFetch- Data fetching with statesuseAsync- Async operation handlinguseSearchParams- URL parameter managementuseOffline- Network status detectionuseNavigatorShare- Web Share API
Device & Sensors
Section titled “Device & Sensors”useGeolocation- Location trackinguseIsTouchDevice- Touch capability detectionuseBattery- Battery status monitoringuseLang- Language detectionuseFirstVisit- First visit detection
Time & Timers
Section titled “Time & Timers”useCountdown- Countdown timeruseCountup- Count-up timeruseStopwatch- Stopwatch functionalityuseTimer- General purpose timer
Utilities
Section titled “Utilities”useRandomColor- Random color generation
Benefits
Section titled “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