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]](hTop issues
#1872I'd like to contribute to react-use31 comments · 2021-03-10#829React-Native support21 comments · 2019-12-11#2092Interface 'IMidiPermissionDescriptor' incorrectly extends interface 'PermissionDescriptor'16 comments · 2021-09-01#88improve/extend async state for useAsync and related hooks16 comments · 2019-01-02#2074Typescript 4.4.2 breaks react-use15 comments · 2021-08-27#1227[useMeasure] Ability to track a custom Ref15 comments · 2020-05-18#702useLocalStorage mismatches server render15 comments · 2019-10-24#2353react-use cannot be imported in Node.js13 comments · 2022-06-20
Latest release
v17.6.1 v17.6.1 2026-06-1017.6.1 (2026-06-10) Bug Fixes deps: update dependency js-cookie to v3 (c0349d9)