streamich /react-use

React Hooks — 👍

★ 43,977⑂ 3,254👁 256⑃ 2,118● 613▤ 257◈ 0
TypeScriptUnlicenseCreated 2018-10-27streamich.github.io/react-use
43,977
stars
+0
3,254
forks
256
watchers
2,118
prs
613
issues
257
releases
0
discussions

README

👍
    
    react-use
    
    
    
    
  
  
    
    
    
       
    
    
      
    
    
      
    
    
      
    
    
    Collection of essential React Hooks.
    Port of libreact.
    
    Translations: 🇨🇳 汉语
  
  
  
  
  
  npm i react-use
  
  
  
  
  


- Sensors
  - useBattery — tracks device battery state. [![][img-demo]](https://codesandbox.io/s/qlvn662zww)
  - useGeolocation — tracks geo location state of user's device. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usegeolocation--demo)
  - useHover and useHoverDirty — tracks mouse hover state of some element. [![][img-demo]](https://codesandbox.io/s/zpn583rvx)
  - useHash — tracks location hash value. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usehash--demo)
  - useIdle — tracks whether user is being inactive.
  - useIntersection — tracks an HTML element's intersection. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-useintersection--demo)
  - useKey, useKeyPress, useKeyboardJs, and useKeyPressEvent — track keys. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usekeypressevent--demo)
  - useLocation and useSearchParam — tracks page navigation bar location state.
  - useLongPress — tracks long press gesture of some element.
  - useMedia — tracks state of a CSS media query. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemedia--demo)
  - useMediaDevices — tracks state of connected hardware devices.
  - useMotion — tracks state of device's motion sensor.
  - useMouse and useMouseHovered — tracks state of mouse position. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemouse--docs)
  - useMouseWheel — tracks deltaY of scrolled mouse wheel. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemousewheel--docs)
  - useNetworkState — tracks the state of browser's network connection. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usenetworkstate--demo)
  - useOrientation — tracks state of device's screen orientation.
  - usePageLeave — triggers when mouse leaves page boundaries.
  - useScratch — tracks mouse click-and-scrub state.
  - useScroll — tracks an HTML element's scroll position. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usescroll--docs)
  - useScrolling — tracks whether HTML element is scrolling.
  - useStartTyping — detects when user starts typing.
  - useWindowScroll — tracks Window scroll position. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usewindowscroll--docs)
  - useWindowSize — tracks Window dimensions. [![][img-demo]](https://codesandbox.io/s/m7ln22668)
  - useMeasure and useSize — tracks an HTML element's dimensions. [![][img-demo]](h

Top issues

Latest release

v17.6.1 v17.6.1 2026-06-10
17.6.1 (2026-06-10)


 Bug Fixes

 deps: update dependency js-cookie to v3 (c0349d9)

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON