Package Exports
- react-use
- react-use/lib/useIdle
- react-use/lib/useList
- react-use/lib/useLocation
- react-use/lib/useMedia
- react-use/lib/useToggle
- react-use/lib/useWindowSize
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-use) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
👍
react-use
Collection of essential React Hooks.
This is mostly port of
libreact
to React Hooks.
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
— tracksWindow
dimensions.
- Side-effects
useTitle
— sets title of the page.
Usage
- You need to have React
16.7.0-alpha.0
or later installed to use Hooks API. - You can import each hook individually
import useToggle from 'react-use/lib/useToggle'
.
License
Unlicense — public domain.