react-use: Collection of React Hooks
Pre-built hooks wrapping browser APIs and common patterns.
Learn more about React Use
react-use is a React Hooks library that provides pre-built hooks for managing state and side effects in functional components. The library wraps browser APIs and common patterns into composable hooks, allowing developers to handle sensor data, DOM measurements, keyboard input, and navigation state. It covers a broad range of use cases from device battery tracking to scroll position monitoring to media query detection. The hooks are designed to integrate directly into React functional components without requiring class-based wrappers or higher-order components.
Comprehensive sensor coverage
Provides hooks for accessing device APIs including battery status, geolocation, motion sensors, media devices, and network state. This allows functional components to directly consume hardware and browser sensor data.
DOM and layout tracking
Includes hooks for monitoring element measurements, scroll positions, intersection state, and hover status. Components can respond to layout changes and user interactions without manual event listener management.
Port of libreact patterns
The library adapts patterns from the libreact project to React Hooks, providing a migration path for developers familiar with that API while leveraging modern React functional component patterns.
import React from 'react';
import { useMouse } from 'react-use';
function MouseTracker() {
const ref = React.useRef(null);
const { docX, docY } = useMouse(ref);
return (
<div ref={ref}>
Mouse position: {docX}, {docY}
</div>
);
}Top in Frontend
Related Repositories
Discover similar tools and frameworks used by developers
Excalidraw
React canvas library with encrypted collaborative drawing.
Tailwind CSS
PostCSS framework generating utility classes from scanned templates.
next.js
File-based React framework with hybrid rendering strategies.
TanStack Table
Framework-agnostic headless table library for building datagrids.
chenyuluoyan_thin
Thin-weight Chinese font family for modern digital interfaces with graceful readability.
Related Reading
Guides and comparisons from the Greptile content library
10 Powerful Code Quality Tools That Catch Bugs Before Deployment
We tested 10 code quality tools that catch bugs before production. Detailed comparison with real-world examples, pricing, and ROI analysis for dev teams.
What is agentic coding? Benefits, risks, and best tools to consider
What engineering leaders need to know about agentic coding: how it differs from AI coding and vibe coding, how it works, the benefits and risks, and the tools worth evaluating.
How to ACTUALLY Think About Code Reviews: The 3-Layer Checklist
A code review checklist and best practices organized around three layers — Mechanical, Structural, and Narrative — that help any team improve code quality without slowing reviews down.
The 7 Best AI Coding Tools for Complex Codebases
The best AI coding tools for complex codebases, ranked on accuracy, suggestion quality, and full-codebase context. See which ones you can actually trust.