Ship faster with batteries included
Debouncing, observers, storage bridges, and browser helpers - ready to drop into production components.
Collection of React Hooks
Typed, tree-shakable utilities with copy-paste examples, SSR callouts, and tests behind every export.
These are real in-page previews: each card links to the hook’s full reference. More categories will land here next.
Toggles, counters, debounce, storage, ref history, and related helpers - click a card to open its live preview. Browse State in the function list →
Boolean (or set) state with a flip/toggle, optional custom setters, and a stable toggler function.
Loading demo...
Increment, decrement, or set a number with optional min/max so values stay in range.
Loading demo...
Debounce a value: the output updates only after the input has settled for a chosen delay.
Loading demo...
Read the value from the previous render - handy for diffs, animations, and simple undo of values.
Loading demo...
A ref that always points at the latest value, so callbacks and effects can read fresh data without re-subscribing.
Loading demo...
Throttle a value so it can change at most once per interval while the input keeps moving.
Loading demo...
Async loadable state: loading / ready / error, optional data, and cancel for stale work.
Loading demo...
Sync React state with `localStorage` (or any `Storage`) with JSON and optional `remove`.
Loading demo...
Async storage: load with `getItem` after mount, then persist with a loading flag and serializers.
Loading demo...
Record when a value last changed, expose a time difference, and reset the timer when needed.
Loading demo...
Every change becomes a history snapshot: undo, redo, clear, and cap length with capacity.
Loading demo...
Ref-based history, but you commit snapshots explicitly for frequent or batched updates.
Loading demo...
Ref history: record a new snapshot only after the value has been still for a debounce period.
Loading demo...
Ref history: record at most one snapshot per throttle window while the value changes fast.
Loading demo...
Event handler with a stable identity that always calls the latest implementation.
Loading demo...
Run a function once on mount, optionally with a returned cleanup on unmount.
Loading demo...
DOM-focused helpers: textarea autosize, outside click handling, drag/drop, element measurement, focus and scroll state. Browse Elements in the function list →
Autosize a textarea to content height; optionally sync the measured height to a wrapper via styleTarget.
Loading demo...
Close a panel when clicks happen outside multiple protected refs (toggle button + content area).
Loading demo...
Drag a card by its handle and keep it inside a container while tracking position and drag state.
Loading demo...
Observe a panel size with ResizeObserver while changing width, height, and inner padding live.
Loading demo...
Track full DOMRect values (x/y/edges/size) while a target moves inside a scrollable container.
Loading demo...
Observe when a sentinel becomes visible inside a scroll root with configurable threshold.
Loading demo...
Resolve and inspect a target node parentElement, and interact with the parent wrapper through the returned node.
Loading demo...
Reflect current window focus/blur state and demonstrate focus-aware background ticking.
Loading demo...
Track live window scrollX/scrollY and expose quick actions for top/middle/end navigation.
Loading demo...
Mirror document.activeElement and inspect focus transitions across inputs, textarea, buttons, and links.
Loading demo...
Track drag-over state and capture dropped files with hover feedback and recent-drop logging.
Loading demo...
Browser APIs and environment hooks: location/hash, media, permissions, clipboard, notifications, orientation, scripts, and more. Browse Browser in the function list →
Read and update window.location.hash with quick presets and custom hash input.
Loading demo...
Watch href/path/search/hash updates from popstate/hashchange and try quick hash navigation actions.
Loading demo...
Broadcast structured messages across tabs on one channel and inspect the latest received payload.
Loading demo...
Swap the tab icon dynamically using preset and custom favicon URLs.
Loading demo...
Open the native file chooser, capture selected files, and reset selection programmatically.
Loading demo...
Open a text file with native picker, edit content, and save it back through the File System Access API.
Loading demo...
Enter, exit, and toggle fullscreen for a target element while tracking real-time fullscreen state.
Loading demo...
Subscribe to multiple media queries and watch match booleans react to viewport and system preference changes.
Loading demo...
Control a media element with custom play/pause, mute, volume, and seek interactions synced from events.
Loading demo...
Poll performance.memory in Chromium and display live used/total/limit JS heap snapshots.
Loading demo...
Check CSS.supports in both property/value and condition-string forms with live user-entered input.
Loading demo...
Read and update a CSS custom property on a target element, keeping UI state in sync with styles.
Loading demo...
Resolve active breakpoint names from window width and inspect current, active list, boolean flags, and >= checks.
Loading demo...
Trigger the Web Bluetooth device picker and track selected device name and request errors.
Loading demo...
Read prefers-color-scheme changes and map them to light/dark/no-preference UI behavior.
Loading demo...
Return a boolean from prefers-color-scheme: dark for straightforward dark-mode branching in UI.
Loading demo...
Persist an explicit dark/light choice and synchronize dark/light classes on the chosen DOM element.
Loading demo...
Expose navigator language priority order and refresh when the browser locale preference changes.
Loading demo...
Observe prefers-reduced-motion and conditionally disable non-essential animations in UI.
Loading demo...
Read prefers-contrast (more/less/custom/no-preference) and map it to stronger or softer visual emphasis.
Loading demo...
Observe prefers-reduced-transparency and replace frosted/translucent UI surfaces with solid backgrounds.
Loading demo...
Watch document dir changes and switch UI direction between ltr and rtl with a simple state value.
Loading demo...
Persist light/dark/auto mode and expose resolved dark state while syncing theme attribute/class on the root.
Loading demo...
Read current URL query values and replace search params through record or URLSearchParams updates.
Loading demo...
Return fallback width on server and initial window width on client for SSR-safe layout branching.
Loading demo...
Track screen orientation type and angle, then derive portrait/landscape oriented UI hints.
Loading demo...
Open the native share sheet with title, text, and URL, then reflect whether share succeeded or was dismissed.
Loading demo...
Invoke short and patterned device vibrations from user gestures, and report whether the browser accepted calls.
Loading demo...
Acquire and release a screen wake lock, tracking active state and request outcomes in real time.
Loading demo...
Inject CSS into a dynamic style tag, swap style variants live, and observe id/loaded/error state.
Loading demo...
Request notification permission and send a browser notification while tracking permission/action outcomes.
Loading demo...
Read top/right/bottom/left safe-area insets and preview layout padding adjusted with current values.
Loading demo...
Track live viewport width/height from resize events and derive orientation/aspect display hints.
Loading demo...
Set document.title from component state and optionally restore the previous title on unmount.
Loading demo...
Toggle body overflow lock with overlay state so background page scrolling is disabled while open.
Loading demo...
Load and track an external script URL with idle/loading/ready/error status and global availability checks.
Loading demo...
Mirror document visibility state and pause visible-only work while the tab or window is hidden.
Loading demo...
Copy text to navigator.clipboard, track success/failure, and expose the hook stored copied value.
Loading demo...
Read ClipboardItem entries from the async clipboard API and inspect returned MIME type groups.
Loading demo...
Observe Permissions API state for selected names and watch updates when browser settings change.
Loading demo...
Subscribe to PerformanceObserver entry types and inspect buffered navigation/resource timeline events.
Loading demo...
Add the package, skim the guide, and pull in only the hooks you need - same APIs you saw in the live demos above.
Works with any React 17+ app. Tree-shaking friendly.
npm i @dedalik/use-reactIssues, roadmap, and source for every hook - stars help others find the project.
Star dedalik/use-reactEvery export with sizes, SSR notes, and runnable snippets.
Browse all functionsGet started guide →