mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
Install
npm i react-use
Reference
- State
useToggle— tracks state of a boolean.useCounter— tracks state of a number.useList— tracks state of an array.useMap— tracks state of an object.
- Sensors
useBattery— tracks device batter state.useGeolocation— tracks geo location state of user's device.useHover— tracks mouse hover state of some element.useIdle— tracks whether user is being inactive.useLocation— tracks page navigation bar location state.useMedia— tracks state of a CSS media query.useMediaDevices— tracks state of connected hardware devices.useMotion— tracks state of device's motion sensor.useNetwork— tracks state of user's internet connection.useOrientation— tracks state of device's screen orientation.useSize— tracks some HTML element's dimensions.useWindowSize— tracksWindowdimensions.
- Side effects
useTitle— sets title of the page.
Usage
- You need to have React
16.7.0-alpha.0or later installed to use Hooks API. - You can import each hook individually
import useToggle from 'react-use/lib/useToggle'.
License
Unlicense — public domain.
Languages
TypeScript
99.6%
JavaScript
0.4%