Modern React Patterns
Created byWalid CHAYBI

A library of
better React hooks

Production-ready, server-safe React hooks for high-performance applications. TypeScript-first, beautifully typed, and documentation-rich.

Connect on LinkedIn

Features

Lightweight

react-hooks-ts is a tiny library without any dependencies, ensuring a lean and efficient solution.

Type-Safe

Catch compile-time errors with ease and unlock strong typing benefits across your stack.

Tree-Shakable

Eliminating unused code and delivering leaner bundles for lightning-fast load times.

Easy to Use

Get started in no time! Explore comprehensive documentation and rich interactive examples.

Developer-Friendly

Simplify development with an intuitive and powerful API. Don't repeat yourself.

Open-Source

Join the vibrant community! Collaborate, contribute, and unlock endless possibilities together.

Pricing

Just kidding! react-hooks-ts is free and open-source.
You can still make your contribution!

Explore The Collection

Utilities

Sensors

Sensors

useInfiniteScroll

Automatically trigger a callback when an element scrolls into view.

Explore reference
Sensors

useMeasure

Real-time element dimension tracking using ResizeObserver.

Explore reference
Sensors

useNetworkState

Track network connection capability and status of the browser.

Explore reference
Sensors

useOrientation

Track the browser window or device rotation and orientation changes.

Explore reference
Sensors

usePageLeave

Detect when the user's mouse cursor leaves the browser tab boundaries.

Explore reference
Sensors

usePermission

Monitor the status of browser permissions for hardware and system APIs.

Explore reference
Sensors

useScreenWakeLock

Prevent the device screen from dimming or locking during critical interactions.

Explore reference
Sensors

useTextSelection

Track and access the currently selected text and its position on the page.

Explore reference
Sensors

useVibrate

Provide declarative haptic feedback using the browser Vibration API.

Explore reference
Sensors

useWindowFocus

Track whether the browser window or tab is currently focused.

Explore reference
Sensors

useBattery

A hook to access battery status information.

Explore reference
Sensors

useClickOutside

React hook that detects clicks outside of a referenced element. Perfect for modals, dropdowns, and sidebars.

Explore reference
Sensors

useDocumentVisibility

A React hook that tracks the document's current visibility state (visible or hidden).

Explore reference
Sensors

useGeolocation

A hook to access the user's geolocation.

Explore reference
Sensors

useHover

A hook to track if an element is being hovered.

Explore reference
Sensors

useIdle

A React hook that detects user inactivity after a configurable timeout.

Explore reference
Sensors

useIntersectionObserver

A powerful React hook to track the visibility of elements in the viewport. Perfect for scroll reveals and lazy loading.

Explore reference
Sensors

useKeyPress

A React hook that detects when specific keyboard keys are pressed or held.

Explore reference
Sensors

useLongPress

A hook to detect long press (press-and-hold) interactions.

Explore reference
Sensors

useMediaQuery

A hook to detect if a media query matches.

Explore reference
Sensors

useMousePosition

A React hook that tracks the mouse cursor's coordinates with high precision.

Explore reference
Sensors

useOnlineStatus

A React hook that tracks the browser's online/offline status in real-time.

Explore reference
Sensors

useScroll

A React hook that tracks scroll position, direction, and progress with high precision.

Explore reference
Sensors

useWindowSize

A React hook that tracks window dimensions and responsive breakpoints in real-time.

Explore reference

State

Expertise & Vision

Built for the modern web

As a Fullstack Web Developer and Generative AI expert, I focus on creating tools that bridge the gap between complex logic and effortless Developer Experience.

50+
Verified Hooks
100%
TypeScript Coverage