-
useBatteryβ tracks device battery state.useGeolocationβ tracks geo location state of user's device.useHoveranduseHoverDirtyβ tracks mouse hover state of some element.useHashβ tracks location hash value.useIdleβ tracks whether user is being inactive.useIntersectionβ tracks an HTML element's intersection.useKey,useKeyPress,useKeyboardJs, anduseKeyPressEventβ track keys.useLocationanduseSearchParamβ tracks page navigation bar location state.useLongPressβ tracks long press gesture of some element.useMediaβ tracks state of a CSS media query.useMediaDevicesβ tracks state of connected hardware devices.useMotionβ tracks state of device's motion sensor.useMouseanduseMouseHoveredβ tracks state of mouse position.useMouseWheelβ tracks deltaY of scrolled mouse wheel.useNetworkStateβ tracks the state of browser's network connection.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.useScrollingβ tracks whether HTML element is scrolling.useStartTypingβ detects when user starts typing.useWindowScrollβ tracksWindowscroll position.useWindowSizeβ tracksWindowdimensions.useMeasureanduseSizeβ tracks an HTML element's dimensions.useBreakpointβ tracksinnerWidth.useScrollbarWidthβ detects browser's native scrollbars width.
-
useAudioβ plays audio and exposes its controls.useClickAwayβ triggers callback when user clicks outside target area.useCssβ dynamically adjusts CSS.useDropanduseDropAreaβ tracks file, link and copy-paste drops.useFullscreenβ display an element or video full-screen.useSliderβ provides slide behavior over any HTML element.useSpeechβ synthesizes speech from a text string.useVibrateβ provide physical feedback using the Vibration API.useVideoβ plays video, tracks its state, and exposes playback controls.
-
useRafβ re-renders component on eachrequestAnimationFrame.useIntervalanduseHarmonicIntervalFnβ re-renders component on a set interval usingsetInterval.useSpringβ interpolates number over time according to spring dynamics.useTimeoutβ re-renders component after a timeout.useTimeoutFnβ calls given function after a timeout.useTweenβ re-renders component, while tweening a number from 0 to 1.
-
useAsync,useAsyncFn, anduseAsyncRetryβ resolves anasyncfunction.useBeforeUnloadβ shows browser alert when user try to reload or close the page.useCookieβ provides way to read, update and delete a cookie.useCopyToClipboardβ copies text to clipboard.useDebounceβ debounces a function.useErrorβ error dispatcher.useFaviconβ sets favicon of the page.useLocalStorageβ manages a value inlocalStorage.useLockBodyScrollβ lock scrolling of the body element.useRafLoopβ calls given function inside the RAF loop.useSessionStorageβ manages a value insessionStorage.useThrottleanduseThrottleFnβ throttles a function.useTitleβ sets title of the page.usePermissionβ query permission status for browser APIs.
- State
useDefaultβ returns the default value when state isnullorundefined.useRafStateβ createssetStatemethod which only updates afterrequestAnimationFrame.useSetStateβ createssetStatemethod which works likethis.setState.useStateListβ circularly iterates over an array.useToggleanduseBooleanβ tracks state of a boolean.useCounteranduseNumberβ tracks state of a number.useListandβ tracks state of an array.useUpsertuseMapβ tracks state of an object.useSetβ tracks state of a Set.useQueueβ implements simple queue.useStateValidatorβ tracks state of an object.useStateWithHistoryβ stores previous state values and provides handles to travel through them.useMultiStateValidatorβ alike theuseStateValidator, but tracks multiple states at a time.useMediatedStateβ like the regularuseStatebut with mediation by custom function.useFirstMountStateβ check if current render is first.useRendersCountβ count component renders.createGlobalStateβ cross component shared state.useMethodsβ neat alternative touseReducer.
Usage β how to import.
Unlicense β public domain.