semantic-release-bot 8e81e8fe6b chore(release): 2.2.0 [skip ci]
# [2.2.0](https://github.com/streamich/react-use/compare/v2.1.0...v2.2.0) (2018-10-29)

### Features

* 🎸 add useGetSet hook ([bfc30b9](https://github.com/streamich/react-use/commit/bfc30b9))
* 🎸 add useUpdate hook ([c00f308](https://github.com/streamich/react-use/commit/c00f308))
2018-10-29 14:10:33 +00:00
2018-10-29 15:05:16 +01:00
2018-10-29 15:06:38 +01:00
2018-10-28 14:32:06 +01:00
2018-10-29 14:10:33 +00:00
2018-10-27 12:15:13 +02:00
2018-10-29 14:10:33 +00:00
2018-10-29 15:05:16 +01:00
2018-10-28 23:22:46 +01:00



👍
react-use






Collection of essential React Hooks.
Port of libreact to React Hooks. See demos.




npm i react-use


Reference

  • Sensors
    • useBattery — tracks device battery 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 — tracks Window dimensions.

  • UI
    • useAudio — plays audio and exposes its controls.
    • useSpeech — synthesizes speech from a text string.

  • Animations
    • useRaf — re-renders component on each reaquestAnimationFrame.
    • useSpring — interpolates number over time according to spring dynamics.
    • useTimeout — returns true after a timeout.
    • useTween — re-renders component, while tweening a number from 0 to 1.
    • useUpdate — returns a callback, which re-renders component when called.

  • Side-effects
  • Lifecycles
  • State
    • useGetSet — returns state getter get() instead of raw state.
    • useObservable — tracks latest value of an Observable.
    • useSetState — creates setState method which works like this.setState.
    • useToggle — tracks state of a boolean.
    • useCounter — tracks state of a number.
    • useList — tracks state of an array.
    • useMap — tracks state of an object.

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.

Description
React Hooks — 👍
Readme Unlicense 146 MiB
Languages
TypeScript 99.6%
JavaScript 0.4%