mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
# 1.0.0 (2018-10-28) ### chore * 🤖 release v1 ([4236cf0](https://github.com/streamich/react-use.git/commit/4236cf0)) ### Continuous Integration * 🎡 store CircleCI artifacts, add git-cz ([690dd5e](https://github.com/streamich/react-use.git/commit/690dd5e)) ### Features * 🎸 add useAsync hook ([258d696](https://github.com/streamich/react-use.git/commit/258d696)) * 🎸 add useAudio hook ([4336aa1](https://github.com/streamich/react-use.git/commit/4336aa1)) * 🎸 add useBattery hook ([73ce535](https://github.com/streamich/react-use.git/commit/73ce535)) * 🎸 add useCounter hook ([79e5b8c](https://github.com/streamich/react-use.git/commit/79e5b8c)) * 🎸 add useCss hook ([2c0a7e4](https://github.com/streamich/react-use.git/commit/2c0a7e4)) * 🎸 add useFavicon hook ([ab1739a](https://github.com/streamich/react-use.git/commit/ab1739a)) * 🎸 add useGeolocation hook ([13a7326](https://github.com/streamich/react-use.git/commit/13a7326)) * 🎸 add useHover hook ([406af20](https://github.com/streamich/react-use.git/commit/406af20)) * 🎸 add useIdle hook ([74d3ece](https://github.com/streamich/react-use.git/commit/74d3ece)) * 🎸 add useLifecycles hook ([f99c89f](https://github.com/streamich/react-use.git/commit/f99c89f)) * 🎸 add useList hook ([4bea508](https://github.com/streamich/react-use.git/commit/4bea508)) * 🎸 add useLocation hook ([46a8e2c](https://github.com/streamich/react-use.git/commit/46a8e2c)) * 🎸 add useLogger hook ([7c38b75](https://github.com/streamich/react-use.git/commit/7c38b75)) * 🎸 add useMap hook ([6509c25](https://github.com/streamich/react-use.git/commit/6509c25)) * 🎸 add useMedia hook ([e1cc9ab](https://github.com/streamich/react-use.git/commit/e1cc9ab)) * 🎸 add useMediaDevices hook ([4ea0277](https://github.com/streamich/react-use.git/commit/4ea0277)) * 🎸 add useMotion hook ([91eb4ea](https://github.com/streamich/react-use.git/commit/91eb4ea)) * 🎸 add useMount and useUnmount hooks ([63a1444](https://github.com/streamich/react-use.git/commit/63a1444)) * 🎸 add useNetwork hook ([5881fa6](https://github.com/streamich/react-use.git/commit/5881fa6)) * 🎸 add useOrientation hook ([c533b97](https://github.com/streamich/react-use.git/commit/c533b97)) * 🎸 add useRaf hook ([26b2593](https://github.com/streamich/react-use.git/commit/26b2593)) * 🎸 add useSetState hook ([972541d](https://github.com/streamich/react-use.git/commit/972541d)) * 🎸 add useSize hook ([620b171](https://github.com/streamich/react-use.git/commit/620b171)) * 🎸 add useSpeech hook ([3b971a2](https://github.com/streamich/react-use.git/commit/3b971a2)) * 🎸 add useSprgin hook ([b4fe5b0](https://github.com/streamich/react-use.git/commit/b4fe5b0)) * 🎸 add useTimeout hook ([86f094e](https://github.com/streamich/react-use.git/commit/86f094e)) * 🎸 add useTitle hook ([1bff6d8](https://github.com/streamich/react-use.git/commit/1bff6d8)) * 🎸 add useToggle() hook ([a36dceb](https://github.com/streamich/react-use.git/commit/a36dceb)) * 🎸 add useTween hook ([877343e](https://github.com/streamich/react-use.git/commit/877343e)) * 🎸 add useWindowSize() hook ([2c46899](https://github.com/streamich/react-use.git/commit/2c46899)) * 🎸 do work on useLocaStorage ([2541716](https://github.com/streamich/react-use.git/commit/2541716)) * 🎸 improve useSize, pass through state to the element ([5b1356a](https://github.com/streamich/react-use.git/commit/5b1356a)) ### BREAKING CHANGES * make semantic-release bump version * Released v1.0.0
👍
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— tracksWindowdimensions.
- UI
- Animations
useRaf— re-renders component on eachreaquestAnimationFrame.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.
- Side-effects
useAsync— resolves anasyncfunction.useCss— dynamically adjusts CSS.useFavicon— sets favicon of the page.useTitle— sets title of the page.
- Lifecycles
useLifecycles— callsmountandunmountcallbacks.useLogger— logs in console as component goes though life-cycles.useMount— callsmountcallbacks.useUnmount— callsunmountcallbacks.
- State
useSetState— createssetStatemethod which works likethis.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.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%