reactuse

Reactuse delivers production-ready hooks that solve real-world problems. Built with a TypeScript-first approach, SSR compatibility, and tree-shaking optimization for modern React applications.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "reactuse" with this command: npx skills add siberiacancode/agent-skills/siberiacancode-agent-skills-reactuse

Reactuse

This skill is a decision-and-implementation guide for reactuse library for react.js / next.js projects. It maps requirements to the most suitable reactuse hook, applies the correct usage pattern, and prefers hook-based solutions over bespoke code to keep implementations concise, maintainable, and performant.

When to Apply

  • Apply this skill whenever assisting development work in React.js / Next.js.
  • Always check first whether a reactuse hook can implement the requirement.
  • Prefer reactuse hooks over custom code to improve readability, maintainability, and performance.
  • Map requirements to the most appropriate hook and follow the hook’s invocation rule.
  • Please refer to the Invocation field in the hooks table. For example:
    • AUTO: Use automatically when applicable.
    • EXTERNAL: Use only if the user already installed the required external dependency; otherwise reconsider, and ask to install only if truly needed.
    • EXPLICIT_ONLY: Use only when explicitly requested by the user.

      NOTE User instructions in the prompt or AGENTS.md may override a hook’s default Invocation rule.

Hooks

All hooks listed below are part of the reactuse library. Each section categorizes hooks based on their functionality.

IMPORTANT: Each hook entry includes a short Description and a detailed Reference. When using any hook, always consult the corresponding document in ./references for usage details and type declarations.

Helpers

HookDescriptionInvocation
createContextCreates a typed context with provider and selector hook.HIGH
createEventEmitterCreates a type-safe event emitter with a subscription hook.LOW
createReactiveContextCreates a typed context selector with optimized updates.LOW
createStoreCreates a external store with state, subscriptions, and a hook.MEDIUM
targetFlexible helper to reference DOM targets for hooks.MEDIUM

Elements

HookDescriptionInvocation
useActiveElementTracks the currently focused element.LOW
useAutoScrollAutomatically scrolls a container to the bottom.LOW
useClickOutsideCalls a callback when clicking outside the target element.HIGH
useDoubleClickDetects double-clicks with optional single-click handler.MEDIUM
useDropZoneCreates a drag-and-drop area with file state.MEDIUM
useFileDialogOpens a file picker and returns selected files.LOW
useFocusTracks focus state and provides focus/blur controls.MEDIUM
useFocusTrapTraps focus within a given element.MEDIUM
useHoverTracks hover state for an element.MEDIUM
useImageLoads an image with query-style state.LOW
useLockScrollLocks scrolling on an element or the document body.MEDIUM
useLongPressDetects long press interactions.MEDIUM
usePaintDraws on a canvas and exposes drawing controls.LOW
useRightClickHandles right-click and long press events.LOW
useScriptLoads a script and returns its status.LOW
useSizeObserves element width and height.LOW
useStickyDetects whether a sticky element is stuck.LOW
useTextareaAutosizeAuto-resizes a textarea based on content.MEDIUM
useTextDirectionGets and sets the text direction of an element.MEDIUM
useWindowFocusReturns the current focus state of the window.LOW
useWindowSizeReturns current window width and height.LOW

Async

HookDescriptionInvocation
useAsyncTracks loading, error, and data state for a promise-returning callback.MEDIUM
useLockCallbackPrevents a callback from running multiple times simultaneously.MEDIUM
useMutationDefines mutation logic with loading, error, and success state.HIGH
useOptimisticAllows showing an optimistic value before the async update resolves.MEDIUM
useQueryDefines query logic with loading, error, success, and refetch state.HIGH

Lifecycle

HookDescriptionInvocation
useAsyncEffectRuns async side effects.MEDIUM
useDidUpdateRuns an effect only on updates (not on initial mount).HIGH
useIsFirstRenderReturns true only on the first render.LOW
useIsomorphicLayoutEffectUses useLayoutEffect on the client and useEffect on the server.HIGH
useMountRuns a callback once when the component mounts.HIGH
useShallowEffectRuns an effect only when dependencies change shallowly or deeply.LOW
useUnmountRuns a callback when the component unmounts.HIGH

Browser

HookDescriptionInvocation
useAudioManages audio playback (play/pause/stop), volume, rate, and sprite segments.LOW
useBatteryReturns battery status and support state.LOW
useBluetoothRequests and connects to Bluetooth devices.LOW
useBreakpointsManages responsive breakpoints and helper predicates.MEDIUM
useBroadcastChannelEnables cross-tab/window messaging.LOW
useClipboardReads and copies text from the clipboard.MEDIUM
useCopyCopies text and resets status after a delay.MEDIUM
useCssVarReads and writes a CSS custom property.LOW
useDisplayMediaProvides screen sharing controls and stream state.LOW
useDocumentEventAttaches an event listener to the document.LOW
useDocumentTitleReads and updates the document title.LOW
useDocumentVisibilityReturns the document visibility state.LOW
useEventListenerAttaches an event listener to a target.HIGH
useEventSourceProvides a reactive wrapper around EventSource.LOW
useEyeDropperProvides access to the EyeDropper API.LOW
useFaviconReads and updates the current favicon.LOW
useFpsMeasures frames per second.LOW
useFullscreenControls fullscreen state for an element.LOW
useGamepadReturns connected gamepads and active status.LOW
useGeolocationReturns the current geolocation and updates on changes.MEDIUM
useMeasureMeasures an element's size and position.LOW
useMediaControlsProvides controls and state for audio/video elements.LOW
useMediaQueryReturns whether a media query matches.MEDIUM
useMemoryReturns the current JS heap memory usage.LOW
useNetworkTracks online status and connection information.LOW
useOnlineReturns whether the user is online.MEDIUM
useOtpCredentialRequests an OTP credential from the user agent.LOW
usePermissionReturns the state of a given permission.MEDIUM
usePictureInPictureControls Picture-in-Picture mode for video elements.LOW
usePointerLockProvides reactive pointer lock controls.LOW
usePostMessageReceives and posts messages between windows/frames.LOW
useRafRuns a callback on each animation frame.LOW
useShareTriggers the native share dialog.MEDIUM
useSpeechRecognitionProvides speech-to-text recognition controls and state.LOW
useSpeechSynthesisProvides text-to-speech controls and state.LOW
useVibrateTriggers vibration with optional intervals.LOW
useVirtualKeyboardTracks virtual keyboard state and exposes controls.LOW
useWakeLockControls the Wake Lock API state.LOW
useWebSocketConnects to a WebSocket server with retries and callbacks.MEDIUM

Utilities

HookDescriptionInvocation
useBatchedCallbackBatches calls and forwards them to a callback.MEDIUM
useConstReturns a constant value initialized once.HIGH
useDebounceCallbackCreates a debounced callback with a cancel method.HIGH
useDebounceEffectRuns an effect after a delay when dependencies change.HIGH
useDebounceStateCreates a debounced state setter.HIGH
useDebounceValueReturns a debounced version of a value.HIGH
useDevicePixelRatioReturns the current device pixel ratio.LOW
useEventReturns a stable callback reference that always calls the latest handler.HIGH
useLastChangedRecords the timestamp of the last change.LOW
useLatestReturns a stable ref that always points to the latest value.MEDIUM
usePreviousReturns the previous value.LOW
useThrottleCallbackCreates a throttled callback with a cancel method.MEDIUM
useThrottleEffectRuns an effect at most once per delay period when dependencies change.MEDIUM
useThrottleStateCreates a throttled state setter.MEDIUM
useThrottleValueReturns a throttled version of a value.MEDIUM

State

HookDescriptionInvocation
useBooleanManages a boolean state with a toggle helper.HIGH
useControllableStateSupports controlled and uncontrolled state patterns.MEDIUM
useCookieReads and writes a cookie value.MEDIUM
useCookiesManages all cookies as a single object.MEDIUM
useCounterManages a numeric counter with bounds.LOW
useDefaultReturns a value or a provided default when nullish.MEDIUM
useDisclosureManages open/close state with helpers.HIGH
useFieldManages input state, validation, and helpers.MEDIUM
useHashManages URL hash value.LOW
useListManages an array with helper methods.MEDIUM
useLocalStorageManages a value in localStorage.HIGH
useMapManages a Map with helper methods.HIGH
useMergedRefMerges multiple refs into a single ref callback.MEDIUM
useObjectManages object state with helper methods for updates and key operations.MEDIUM
useOffsetPaginationManages pagination state for offset-based lists.MEDIUM
useQueueManages a queue with add/remove helpers.MEDIUM
useRafStateUpdates state inside requestAnimationFrame.LOW
useRefStateCreates a ref-like state that updates on assignment.LOW
useSessionStorageManages a value in sessionStorage.MEDIUM
useSetManages a Set with helper methods.MEDIUM
useStateHistoryKeeps state with undo/redo history.MEDIUM
useStepCreates a stepper with next/back helpers.MEDIUM
useStorageManages a value in Web Storage.HIGH
useToggleA boolean switcher with utility functions.HIGH
useUrlSearchParamSyncs a single URL search param with state.HIGH
useUrlSearchParamsSyncs multiple URL search params with state.HIGH
useWizardManages wizard steps and history.MEDIUM

User

HookDescriptionInvocation
useBrowserLanguageReturns the current browser language.MEDIUM
useOperatingSystemReturns the user's operating system based on the user agent.LOW
usePreferredColorSchemeReturns the user's preferred color scheme.MEDIUM
usePreferredContrastReturns the user's contrast preference.MEDIUM
usePreferredDarkReturns whether the user prefers dark mode.MEDIUM
usePreferredLanguagesReturns the user's preferred languages.MEDIUM
usePreferredReducedMotionReturns the reduced motion preference.LOW

Sensors

HookDescriptionInvocation
useDeviceMotionProvides device motion data with optional throttling.LOW
useDeviceOrientationProvides the current device orientation.LOW
useHotkeysListens for keyboard shortcuts.MEDIUM
useIdleTracks whether the user is idle and last active time.LOW
useInfiniteScrollTriggers a callback when scroll reaches an edge.MEDIUM
useIntersectionObserverTracks intersection state for an element.MEDIUM
useKeyboardRegisters keydown/keyup listeners on a target.MEDIUM
useKeyPressTracks whether specific keys are pressed.MEDIUM
useKeyPressEventRuns a handler when specific keys are pressed.LOW
useKeysPressedTracks all currently pressed keys.LOW
useMouseTracks mouse coordinates relative to page and element.LOW
useMutationObserverObserves DOM mutations on an element.LOW
useOrientationReturns the current screen orientation and lock controls.LOW
usePageLeaveDetects when the mouse leaves the page.LOW
useParallaxCreates a parallax effect based on mouse or device orientation.LOW
usePerformanceObserverObserves performance entries.LOW
useResizeObserverObserves size changes for an element.LOW
useScrollTracks scroll state and provides scroll helpers.LOW
useScrollIntoViewScrolls an element into view and exposes a trigger.LOW
useScrollToScrolls to a specific position with a trigger.LOW
useTextSelectionTracks text selection details.LOW
useVisibilityTracks whether an element is visible in the viewport.MEDIUM
useWindowEventAttaches an event listener to the window object.LOW
useWindowScrollTracks window scroll position and exposes scrollTo.LOW

Time

HookDescriptionInvocation
useIntervalCreates an interval with controls to pause and resume it.HIGH
useProgressCreates progress state with auto-incrementing controls.MEDIUM
useStopwatchCreates a stopwatch with start, pause, and reset controls.HIGH
useTimeProvides the current time split into multiple fields.MEDIUM
useTimeoutRuns a callback after a delay and returns a ready flag.MEDIUM
useTimerCreates a countdown timer with controls and callbacks.MEDIUM

Debug

HookDescriptionInvocation
useLoggerLogs mount, update, and unmount for a component.LOW
useRenderCountReturns how many times a component has rendered.LOW
useRenderInfoProvides render count and timing info, with optional logging.LOW
useRerenderForces a component rerender on demand.MEDIUM

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

juniors-best-practice

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

vercel-react-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

web-design-guidelines

No summary provided by upstream source.

Repository SourceNeeds Review