JSPM

react-use

8.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2512395
  • Score
    100M100P100Q182701F
  • License Unlicense

Collection of React Hooks

Package Exports

  • react-use
  • react-use/esm/useFullscreen
  • react-use/esm/useSize
  • react-use/esm/useToggle
  • react-use/lib/useAsync
  • react-use/lib/useAsyncFn
  • react-use/lib/useAudio
  • react-use/lib/useBoolean
  • react-use/lib/useClickAway
  • react-use/lib/useDebounce
  • react-use/lib/useDeepCompareEffect
  • react-use/lib/useEffectOnce
  • react-use/lib/useEvent
  • react-use/lib/useGetSetState
  • react-use/lib/useHoverDirty
  • react-use/lib/useIdle
  • react-use/lib/useKey
  • react-use/lib/useKeyPressEvent
  • react-use/lib/useList
  • react-use/lib/useLocalStorage
  • react-use/lib/useLocation
  • react-use/lib/useLockBodyScroll
  • react-use/lib/useMedia
  • react-use/lib/useObservable
  • react-use/lib/useRefMounted
  • react-use/lib/useScroll
  • react-use/lib/useSetState
  • react-use/lib/useSpring
  • react-use/lib/useToggle
  • react-use/lib/useUpdateEffect
  • react-use/lib/useVideo
  • 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





npm package npm downloads demos
Collection of essential React Hooks. Port of libreact.
Translations: 🇨🇳 汉语




npm i react-use








Usage


You need to have React 16.8.1 or later installed to use Hooks API.

You can import each hook individually import useToggle from 'react-use/lib/useToggle'.

or use ES6 named imports import {useToggle} from 'react-use'.

Depending on your bundler you might run into a missing dependency error with ES6 named import statements. Some hooks require you to install peer dependencies so we recommend using individual imports. If you want the best of both worlds you can transform the named import statements to individual import statements with babel-plugin-import by adding the following config to your `.babelrc` file:

[
  "import", {
    "libraryName": "react-use",
    "libraryDirectory": "lib",
    "camel2DashComponentName": false
  }
]

License

Unlicense — public domain.