CLAUDE CODE MARKETPLACES

react-use

Collection of essential React Hooks for sensors, UI, animations, side-effects, lifecycles, and state management

npx skills add https://github.com/hairyf/skills --skill react-use
SKILL.md

react-use

The skill is based on react-use v17.6.0, generated at 2026-01-29.

react-use is a collection of essential React Hooks that provide ready-to-use functionality for common patterns in React applications. It includes hooks for sensors, UI interactions, animations, side-effects, lifecycle management, and state management.

Core References

TopicDescriptionReference
UsageImport patterns and tree-shaking recommendationscore-usage

Sensors

Sensor hooks listen to changes in browser APIs and device interfaces, forcing components to re-render with updated state.

TopicDescriptionReference
useBatteryTracks device battery statussensors-battery
useGeolocationTracks geo location state of user's devicesensors-geolocation
useHoverTracks mouse hover state of an elementsensors-hover
useHashTracks location hash valuesensors-hash
useIdleTracks whether user is being inactivesensors-idle
useIntersectionTracks an HTML element's intersectionsensors-intersection
useKeyTracks key pressessensors-key
useKeyPressTracks key press statesensors-key-press
useKeyPressEventHandles key press eventssensors-key-press-event
useKeyboardJsTracks keyboard key combinationssensors-keyboard-js
useLocationTracks page navigation bar location statesensors-location
useSearchParamTracks URL search parameterssensors-search-param
useLongPressTracks long press gesturesensors-long-press
useMediaTracks state of a CSS media querysensors-media
useMediaDevicesTracks state of connected hardware devicessensors-media-devices
useMotionTracks state of device's motion sensorsensors-motion
useMouseTracks state of mouse positionsensors-mouse
useMouseWheelTracks deltaY of scrolled mouse wheelsensors-mouse-wheel
useNetworkStateTracks browser's network connection statesensors-network-state
useOrientationTracks device's screen orientationsensors-orientation
usePageLeaveTriggers when mouse leaves page boundariessensors-page-leave
useScratchTracks mouse click-and-scrub statesensors-scratch
useScrollTracks an HTML element's scroll positionsensors-scroll
useScrollingTracks whether HTML element is scrollingsensors-scrolling
useStartTypingDetects when user starts typingsensors-start-typing
useWindowScrollTracks Window scroll positionsensors-window-scroll
useWindowSizeTracks Window dimensionssensors-window-size
useMeasureTracks an HTML element's dimensionssensors-measure
useSizeTracks element sizesensors-size
createBreakpointTracks innerWidth with breakpointssensors-breakpoint
useScrollbarWidthDetects browser's native scrollbars widthsensors-scrollbar-width
usePinchZoomTracks pointer events to detect pinch zoomsensors-pinch-zoom

UI

UI hooks allow you to control and subscribe to state changes of UI elements.

TopicDescriptionReference
useAudioPlays audio and exposes its controlsui-audio
useClickAwayTriggers callback when user clicks outside target areaui-click-away
useCssDynamically adjusts CSSui-css
useDropTracks file, link and copy-paste dropsui-drop
useFullscreenDisplay an element or video full-screenui-fullscreen
useSliderProvides slide behavior over any HTML elementui-slider
useSpeechSynthesizes speech from a text stringui-speech
useVibrateProvides physical feedback using Vibration APIui-vibrate
useVideoPlays video, tracks its state, and exposes playback controlsui-video

Animations

Animation hooks usually interpolate numeric values over time.

TopicDescriptionReference
useRafRe-renders component on each requestAnimationFrameanimations-raf
useIntervalRe-renders component on a set intervalanimations-interval
useHarmonicIntervalFnHarmonic interval functionanimations-harmonic-interval
useSpringInterpolates number over time according to spring dynamicsanimations-spring
useTimeoutRe-renders component after a timeoutanimations-timeout
useTimeoutFnCalls given function after a timeoutanimations-timeout-fn
useTweenRe-renders component while tweening a number from 0 to 1animations-tween
useUpdateReturns a callback which re-renders component when calledanimations-update

Side-effects

Side-effect hooks allow your app to trigger various side-effects using browser's API.

TopicDescriptionReference
useAsyncResolves an async functionside-effects-async
useAsyncFnAsync function with manual executionside-effects-async-fn
useAsyncRetryAsync function with retry capabilityside-effects-async-retry
useBeforeUnloadShows browser alert when user tries to reload or close the pageside-effects-before-unload
useCookieProvides way to read, update and delete a cookieside-effects-cookie
useCopyToClipboardCopies text to clipboardside-effects-copy-to-clipboard
useDebounceDebounces a functionside-effects-debounce
useErrorError dispatcherside-effects-error
useFaviconSets favicon of the pageside-effects-favicon
useLocalStorageManages a value in localStorageside-effects-local-storage
useSessionStorageManages a value in sessionStorageside-effects-session-storage
useLockBodyScrollLocks scrolling of the body elementside-effects-lock-body-scroll
useRafLoopCalls given function inside the RAF loopside-effects-raf-loop
useThrottleThrottles a functionside-effects-throttle
useThrottleFnThrottle function variantside-effects-throttle-fn
useTitleSets title of the pageside-effects-title
usePermissionQuery permission status for browser APIsside-effects-permission

Lifecycles

Lifecycle hooks modify and extend built-in React hooks or imitate React Class component lifecycle patterns.

TopicDescriptionReference
useEffectOnceModified useEffect that only runs oncelifecycles-effect-once
useEventSubscribe to eventslifecycles-event
useLifecyclesCalls mount and unmount callbackslifecycles-lifecycles
useMountedStateTracks if component is mountedlifecycles-mounted-state
useUnmountPromiseTrack if component is mounted with promise supportlifecycles-unmount-promise
usePromiseResolves promise only while component is mountedlifecycles-promise
useLoggerLogs in console as component goes through life-cycleslifecycles-logger
useMountCalls mount callbackslifecycles-mount
useUnmountCalls unmount callbackslifecycles-unmount
useUpdateEffectRun an effect only on updateslifecycles-update-effect
useIsomorphicLayoutEffectuseLayoutEffect that works on serverlifecycles-isomorphic-layout-effect
useDeepCompareEffectuseEffect with deep comparisonlifecycles-deep-compare-effect
useShallowCompareEffectuseEffect with shallow comparisonlifecycles-shallow-compare-effect
useCustomCompareEffectuseEffect with custom comparison functionlifecycles-custom-compare-effect

State

State hooks allow you to easily manage state of booleans, arrays, and maps.

TopicDescriptionReference
createMemoFactory of memoized hooksstate-create-memo
createReducerFactory of reducer hooks with custom middlewarestate-create-reducer
createReducerContextFactory of hooks for sharing state between componentsstate-create-reducer-context
createStateContextFactory of hooks for sharing state between componentsstate-create-state-context
createGlobalStateCross component shared statestate-create-global-state
useDefaultReturns the default value when state is null or undefinedstate-default
useGetSetReturns state getter get() instead of raw statestate-get-set
useGetSetStateCombination of useGetSet and useSetStatestate-get-set-state
useLatestReturns the latest state or propsstate-latest
usePreviousReturns the previous state or propsstate-previous
usePreviousDistinctLike usePrevious but with a predicatestate-previous-distinct
useObservableTracks latest value of an Observablestate-observable
useRafStateCreates setState method which only updates after requestAnimationFramestate-raf-state
useSetStateCreates setState method which works like this.setStatestate-set-state
useToggleTracks state of a booleanstate-toggle
useCounterTracks state of a numberstate-counter
useListTracks state of an arraystate-list
useMapTracks state of an objectstate-map
useSetTracks state of a Setstate-set
useQueueImplements simple queuestate-queue
useStateListCircularly iterates over an arraystate-state-list
useStateValidatorValidates state with a validator functionstate-state-validator
useStateWithHistoryStores previous state values and provides handles to travel through themstate-state-with-history
useMultiStateValidatorAlike useStateValidator but tracks multiple statesstate-multi-state-validator
useMediatedStateLike regular useState but with mediation by custom functionstate-mediated-state
useFirstMountStateCheck if current render is firststate-first-mount-state
useRendersCountCount component rendersstate-renders-count
useMethodsNeat alternative to useReducerstate-methods

Miscellaneous

TopicDescriptionReference
useEnsuredForwardedRefUse a React.forwardedRef safelymisc-ensured-forwarded-ref
Installs632
GitHub Stars19
LanguageMDX
AddedJan 29, 2026
View on GitHub