Skip to content

v4.4.0

Choose a tag to compare

@github-actions github-actions released this 12 Oct 01:50
· 34 commits to main since this release
c91a06f

Version 4.4.0 – Adds a collection of new hooks for URL hash, idle detection, long‑press handling, online status, pending commits, and stable value references.

  • useHash – Returns the URL hash without the # and a setter; { replace: true } replaces the history entry. Shared by every component through useSyncExternalStore.
  • useIdle – Returns whether the user has been idle for timeout ms, counting pointer, key, wheel, and touch events on window (or custom events) and page visibility changes as activity, without re‑rendering while already active.
  • useLongPress – Calls a callback once a pointer press (or, with keyboard: true, holding Enter or Space) lasts threshold ms, cancels on release, leave, or movement past moveTolerance, and reports isLongPressed() so a click handler can skip the click that ends a long press.
  • useOnlineStatus – Returns whether the browser has a network connection (navigator.onLine) and follows the online and offline events.
  • usePendingCommit – Keeps a controlled component’s last commit until the parent renders again so two commits in the same tick build on each other.
  • useStableValue – Keeps an object or array’s previous reference while the new value is shallowly equal (or equal by a custom isEqual), so an inline prop retains one identity until its contents change.

What's Changed

Full Changelog: v4.3.0...v4.4.0