Repository navigation
v4.4.0
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 throughuseSyncExternalStore. - useIdle – Returns whether the user has been idle for
timeoutms, counting pointer, key, wheel, and touch events onwindow(or customevents) 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) laststhresholdms, cancels on release, leave, or movement pastmoveTolerance, and reportsisLongPressed()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 theonlineandofflineevents. - 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
- feat: add usePendingCommit hook by @pjb0811 in #257
- feat: add useStableValue hook by @pjb0811 in #264
- feat: add useHash hook by @pjb0811 in #265
- feat: add useOnlineStatus hook by @pjb0811 in #266
- feat: add useLongPress hook by @pjb0811 in #267
- feat: add useIdle hook by @pjb0811 in #268
- chore: version packages by @github-actions[bot] in #258
Full Changelog: v4.3.0...v4.4.0