Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-use

> ็ผ–็จ‹่ฏญ่จ€
Open source

React Hooks โ€” ๐Ÿ‘

44.0K stars0 likes1 views
WebsiteGitHub

About

React Hooks โ€” ๐Ÿ‘

  • Sensors
    • useBattery โ€” tracks device battery state. ![][img-demo]
    • useGeolocation โ€” tracks geo location state of user's device. ![][img-demo]
    • useHover and useHoverDirty โ€” tracks mouse hover state of some element. ![][img-demo]
    • useHash โ€” tracks location hash value. ![][img-demo]
    • useIdle โ€” tracks whether user is being inactive.
    • useIntersection โ€” tracks an HTML element's intersection. ![][img-demo]
    • useKey, useKeyPress, useKeyboardJs, and useKeyPressEvent โ€” track keys. ![][img-demo]
    • useLocation and useSearchParam โ€” tracks page navigation bar location state.
    • useLongPress โ€” tracks long press gesture of some element.
    • useMedia โ€” tracks state of a CSS media query. ![][img-demo]
    • useMediaDevices โ€” tracks state of connected hardware devices.
    • useMotion โ€” tracks state of device's motion sensor.
    • useMouse and useMouseHovered โ€” tracks state of mouse position. ![][img-demo]
    • useMouseWheel โ€” tracks deltaY of scrolled mouse wheel. ![][img-demo]
    • useNetworkState โ€” tracks the state of browser's network connection. ![][img-demo]
    • useOrientation โ€” tracks state of device's screen orientation.
    • usePageLeave โ€” triggers when mouse leaves page boundaries.
    • useScratch โ€” tracks mouse click-and-scrub state.
    • useScroll โ€” tracks an HTML element's scroll position. ![][img-demo]
    • useScrolling โ€” tracks whether HTML element is scrolling.
    • useStartTyping โ€” detects when user starts typing.
    • useWindowScroll โ€” tracks Window scroll position. ![][img-demo]
    • useWindowSize โ€” tracks Window dimensions. ![][img-demo]
    • useMeasure and useSize โ€” tracks an HTML element's dimensions. ![][img-demo]
    • createBreakpoint โ€” tracks innerWidth
    • useScrollbarWidth โ€” detects browser's native scrollbars width. ![][img-demo]
    • usePinchZoom โ€” tracks pointer events to detect pinch zoom in and out status. ![][img-demo]

  • UI
    • useAudio โ€” plays audio and exposes its controls. ![][img-demo]
    • useClickAway โ€” triggers callback when user clicks outside target area.
    • useCss โ€” dynamically adjusts CSS.
    • useDrop and useDropArea โ€” tracks file, link and copy-paste drops.
    • useFullscreen โ€” display an element or video full-screen. ![][img-demo]
    • useSlider โ€” provides slide behavior over any HTML element. ![][img-demo]
    • useSpeech โ€” synthesizes speech from a text string. ![][img-demo]
    • useVibrate โ€” provide physical feedback using the Vibration API. ![][img-demo]
    • useVideo โ€” plays video, tracks its state, and exposes playback controls. ![][img-demo]

  • Animations
    • useRaf โ€” re-renders component on each requestAnimationFrame.
    • useInterval and useHarmonicIntervalFn โ€” re-renders component on a set interval using setInterval.
    • useSpring โ€” interpolates number over time according to spring dynamics.
    • useTimeout โ€” re-renders component after a timeout.
    • useTimeoutFn โ€” calls given function after a timeout. ![][img-demo]
    • useTween โ€” re-renders component, while tweening a number from 0 to 1. ![][img-demo]
    • useUpdate โ€” returns a callback, which re-renders component when called.

  • Side-effects
    • useAsync, useAsyncFn, and useAsyncRetry โ€” resolves an async function.
    • useBeforeUnload โ€” shows browser alert when user try to reload or close the page.
    • useCookie โ€” provides way to read, update and delete a cookie. ![][img-demo]
    • useCopyToClipboard โ€” copies text to clipboard.
    • useDebounce โ€” debounces a function. ![][img-demo]
    • useError โ€” error dispatcher. ![][img-demo]
    • useFavicon โ€” sets favicon of the page.
    • useLocalStorage โ€” manages a value in localStorage.
    • useLockBodyScroll โ€” lock scrolling of the body element.
    • useRafLoop โ€” calls given function inside the RAF loop.
    • useSessionStorage โ€” manages a value in sessionStorage.
    • useThrottle and useThrottleFn โ€” throttles a function. ![][img-demo]
    • useTitle โ€” sets title of the page.
    • usePermission โ€” query permission status for browser APIs.

  • Lifecycles
    • useEffectOnce โ€” a modified useEffect hook that only runs once.
    • useEvent โ€” subscribe to events.
    • useLifecycles โ€” calls mount and unmount callbacks.
    • useMountedState and useUnmountPromise โ€” track if component is mounted.
    • usePromise โ€” resolves promise only while component is mounted.
    • useLogger โ€” logs in console as component goes through life-cycles.
    • useMount โ€” calls mount callbacks.
    • useUnmount โ€” calls unmount callbacks.
    • useUpdateEffect โ€” run an effect only on updates.
    • useIsomorphicLayoutEffect โ€” useLayoutEffect that that works on server.
    • useDeepCompareEffect, useShallowCompareEffect, and useCustomCompareEffect

  • State
    • createMemo โ€” factory of memoized hooks.
    • createReducer โ€” factory of reducer hooks with custom middleware.
    • createReducerContext and createStateContext โ€” factory of hooks for a sharing state between components.
    • useDefault โ€” returns the default value when state is null or undefined.
    • useGetSet โ€” returns state getter get() instead of raw state.
    • useGetSetState โ€” as if useGetSet and useSetState had a baby.
    • useLatest โ€” returns the latest state or props
    • usePrevious โ€” returns the previous state or props. ![][img-demo]
    • usePreviousDistinct โ€” like usePrevious but with a predicate to determine if previous should update.
    • useObservable โ€” tracks latest value of an Observable.
    • useRafState โ€” creates setState method which only updates after requestAnimationFrame. ![][img-demo]
    • useSetState โ€” creates setState method which works like this.setState. ![][img-demo]
    • useStateList โ€” circularly iterates over an array. ![][img-demo]
    • useToggle and useBoolean โ€” tracks state of a boolean. ![][img-demo]
    • useCounter and useNumber โ€” tracks state of a number. ![][img-demo]
    • useList and useUpsert โ€” tracks state of an array. ![][img-demo]
    • useMap โ€” tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi

Issuesยท 665 open

View all issuesOpen on GitHub
  • #2718

    useThrottle stops updating after React 18 StrictMode effect replay

    Updated Aug 5, 2026
  • #2676

    Add useMicrophone hook

    Updated Jul 10, 2026
  • #2618

    useWindowSize hook triggers failure in unit test

    Updated Jul 10, 2026
  • #2605

    Remove potentially unnecessary use of useEffect in usePrevious

    Updated Jul 2, 2026
  • #956

    `createGlobalState` should use `useIsomorphicLayoutEffect`

    bugenhancementhelp wantedgood first issueUpdated Jun 16, 2026
  • #856

    createReducer not working with Typescript (type def errors showing up)

    bughelp wantedgood first issueUpdated Jun 16, 2026
  • #2708

    useAudio/useVideo play lock resets across renders

    Updated Jun 14, 2026
  • #2677

    Add Generic Fn for useDebounce

    Updated Apr 11, 2026
  • #2700

    `useDeepCompareEffect` throws error when comparing objects created with `Object.create(null)`

    Updated Apr 1, 2026
  • #2675

    `useScrolling` doesn't clean up its timer

    Updated Feb 19, 2026

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category็ผ–็จ‹่ฏญ่จ€
PricingOpen source

> Related tools

T
TypeScript
JavaScript ็š„่ถ…้›†๏ผŒไธบๅ‰็ซฏไธŽๅ…จๆ ˆๆไพ›้™ๆ€็ฑปๅž‹
P
Python
้€š็”จ็ผ–็จ‹่ฏญ่จ€๏ผŒๅนฟๆณ›็”จไบŽ Webใ€ๆ•ฐๆฎไธŽ AI
G
Go
Google ๆŽจๅ‡บ็š„็ฎ€ๆด้ซ˜ๆ•ˆ็ณป็ปŸ่ฏญ่จ€