Skip to content

Releases: senthilkumar979/useThisHook

1.3.0

Choose a tag to compare

@senthilkumar979 senthilkumar979 released this 27 Oct 09:45
bf89dbf

[1.3.0] - 2026-10-27

Added

  • useAsyncState — idle / loading / success / error with abort and optional immediate fetch
  • useOptimisticAction — optimistic update with rollback and duplicate-submit guard
  • useRetry — retries, constant or exponential backoff, and cancel
  • useAsyncQueue — FIFO async tasks with a concurrency cap
  • usePolling — interval polling that pauses when the tab is hidden
  • useOnlineQueue — in-memory outbox that flushes when the browser is online
  • useStorageQuota — navigator.storage.estimate() usage and quota
  • useInstallPrompt — PWA beforeinstallprompt capture and prompt()
  • useCrossTabState — JSON state synced across tabs (BroadcastChannel + storage)
  • useRenderTracker — render counts; console.debug in development
  • useWhyDidYouUpdate — log which snapshot keys changed between renders
  • useKeyboardShortcut — window key combos with cleanup
  • useLongPress — mouse and touch press-and-hold handlers
  • usethishook-mcp@1.3.0 — catalog covers all 53 hooks (list_hooks, search_hooks, get_hook, recommend_hook)

Docs

  • Playground comparison page vs usehooks-ts / react-use, MCP setup page, unique-hook spotlight
  • Per-route HTML titles/descriptions for crawlers; StackBlitz and CodeSandbox try-online links on every hook page

1.2.0

Choose a tag to compare

@senthilkumar979 senthilkumar979 released this 16 Oct 15:58

usethishook 1.2.0

Minor release: seven new hooks, optional custom locales for useAmountInput, and playground New badges. No breaking changes. The library now ships 40 typed hooks.

npm i usethishook@^1.2.0

Playground: usethishook.mentorbridge.in

State

  • useSessionStorage — JSON state in sessionStorage (same shape as useLocalStorage)
  • useThrottle — throttle a value (leading + trailing)

Browser

  • useScrollLock — lock / unlock document.body scroll for overlays
  • useDocumentVisibility — Page Visibility API (visible | hidden)
  • useIdle — true after a period of no user activity

App

  • useThrottledCallback — throttle a function, with cancel
  • useUpdateEffect — like useEffect, but skips the initial mount

Forms

  • useAmountInput — optional locales map to register or override separators beyond built-in en / de / nl / fr
  • Exported AmountLocaleConfig type

1.1.0

Choose a tag to compare

@senthilkumar979 senthilkumar979 released this 06 Oct 19:59
454773a

useThisHook v1.1.0

Released: 2026-10-06
npm: usethishook@1.1.0
Compare: v1.0.0...v1.1.0


Highlights

This minor release adds useFingerprint: a typed, zero-dependency hook that builds a client-side visitor id from browser signals. No API key, no network request, and not the commercial Fingerprint Identification product.

Use it for anonymous personalization hints, correlating sessions without cookies, or lightweight abuse signals — treating the id as a hint, not a hard identity.

Live demo & API: usethishook.mentorbridge.in/useFingerprint


Added — useFingerprint(options?)

Signature

useFingerprint(options?: { enabled?: boolean }): {
  visitorId: string | null;
  components: FingerprintComponents | null;
  isPending: boolean;
  error: Error | null;
  refresh: () => Promise<string | null>;
}

Options

Option Type Default Description
enabled boolean true When false, skip auto-run on mount; call refresh() yourself.

Return values

Field Type Description
visitorId string | null Hex hash of collected signals, or null before the first successful run.
components FingerprintComponents | null Named browser signals that went into the hash.
isPending boolean true while identification is running.
error Error | null Set when collection throws unexpectedly.
refresh () => Promise<string | null> Re-run identification; returns the new visitor id (or null).

Exported types

  • UseFingerprintOptions
  • UseFingerprintReturn
  • FingerprintComponents

Signals collected (into components, then hashed):

  • Environment: userAgent, language, languages, platform, timezone / offset
  • Display: colorDepth, screenResolution, availableScreenResolution
  • Device: deviceMemory, hardwareConcurrency, touch support / maxTouchPoints, pdfViewerEnabled
  • Storage / privacy: sessionStorage, localStorage, indexedDB, cookieEnabled, doNotTrack
  • Graphics: canvas data URL, WebGL vendor/renderer string

Hashing uses an FNV-1a–style 32-bit hex id (FingerprintJS-style client hash). Collection yields one tick so canvas/WebGL work does not block the current frame. Concurrent / unmounted runs are ignored via a run-id guard. On the server (window missing), refresh() returns null.

Example

import { useFingerprint } from 'usethishook';

export const VisitorBadge = () => {
  const { visitorId, isPending, error, refresh } = useFingerprint();

  if (isPending) return <p>Identifying…</p>;
  if (error) return <p>Could not fingerprint: {error.message}</p>;

  return (
    <div>
      <code>{visitorId}</code>
      <button type="button" onClick={() => void refresh()}>
        Refresh
      </button>
    </div>
  );
};

Deferred start

const { visitorId, refresh, isPending } = useFingerprint({ enabled: false });

// later, e.g. after consent:
await refresh();

Important caveats

  • Client-only fingerprinting. Identical or locked-down browsers can share or churn ids.
  • Not Fingerprint Identification (SaaS). No cloud matching, no API key, no network.
  • Privacy-focused browsers may reduce entropy — treat visitorId as a soft signal.
  • Playground may also use separate commercial Fingerprint wiring for the site itself; that is not part of the usethishook package API.

Docs & playground

  • New Browser catalog entry for useFingerprint
  • Live demo, copy-paste example, and full API reference page
  • Sitemap / SEO coverage for the new hook route

Upgrade

npm i usethishook@1.1.0
  • From 1.0.0: additive only — no breaking API changes in the published hook surface.
  • Requires React 18+ (peer), Node ≥ 20 for tooling/publish (unchanged).

Links


Out of scope for this npm release: usethishook-mcp is still listed under Unreleased in CHANGELOG.md (separate MCP package). Vercel Analytics / Speed Insights are playground-only and do not ship inside usethishook.

v1.0.0

Choose a tag to compare

@senthilkumar979 senthilkumar979 released this 30 Sep 07:53
baf1d19

Added

  • First stable SemVer release (1.0.0). Runtime API matches 0.4.0; breaking removals already shipped in 0.3.0.
  • Nested exports conditions (import / require each with types + default) and typings for broader TypeScript / ESM detectors
  • Vitest coverage (@vitest/coverage-v8), Codecov upload from CI, and Codecov badge
  • Legacy GitHub commit status (ci/tests) from CI for analyzers that do not read Check Runs

Changed

  • verify:commit runs test:coverage so coverage is produced on every local verify and CI run

v0.2.0

Choose a tag to compare

@senthilkumar979 senthilkumar979 released this 13 Sep 08:05
0c5fb40

useThisHook v0.2.0

Five new browser hooks, plus playground navigation and docs polish.

Install

npm install usethishook

Peer dependencies: React 18+ and React DOM 18+.

Added

Hooks

  • useEventListener — listen on window, document, a node, or a ref; handler stays current without re-subscribing
  • useTimeout — run a callback once after a delay; pass null to pause
  • useHover — { ref, isHovered } for pointer enter/leave
  • useKeyPress — true while a key is held; ignores input, textarea, select, and contenteditable
  • usePreferredColorScheme — OS 'light' | 'dark' via prefers-color-scheme (not the playground theme toggle)

Playground

  • Dedicated Home control in the sidebar
  • Smooth-scroll to the top when changing hook routes
  • Radix Scroll Area on the sidebar hook list
  • Clearer State / Browser / App group headers

Note

In-page home links (#install, #hooks) are not treated as hook routes, so Install / Browse hooks jump to the right section.

0.1.1

Choose a tag to compare

@senthilkumar979 senthilkumar979 released this 12 Sep 09:14

Tag: v0.1.0
Title: useThisHook v0.1.0

Body:

useThisHook v0.1.0

First public release of useThisHook — a typed, tree-shakeable set of React hooks for everyday UI, forms, lists, overlays, and browser APIs.

Install

npm install usethishook
Peer dependency: React 18+ (React 19 supported). Named exports only.

Docs
[Playground (Vercel)](https://usethishook.mentorbridge.in/)
[Playground (GitHub Pages)](https://senthilkumar979.github.io/useThisHook/)
[npm: usethishook](https://www.npmjs.com/package/usethishook)
What's included
State
useToggle — boolean with toggle, setTrue, setFalse
useCounter — increment, decrement, reset
useDisclosure — open / close / toggle for menus and dialogs
useDebounce — debounce a rapidly changing value
usePrevious — previous render's value
useInterval — declarative setInterval (null pauses)
useCopyToClipboard — clipboard write + last copied text
useLocalStorage — JSON state persisted in localStorage
useDocumentTitle — set document.title while mounted
Browser
useOnlineStatus — navigator.onLine plus online/offline events
useMediaQuery — subscribe to a CSS media query
useWindowSize — viewport width and height
useOnClickOutside — handler when the user presses outside a ref
useOverlay — promise-based custom overlay
useStepFlow — multi-step wizard that resolves when finished
useAsyncSelect — native file picker as a Promise
App
useStableCallback — stable function identity, always-latest body
useOnChange — callback when a value changes, not on mount
useResetState — local state that resets when a source key changes
useAsyncAction — pending / error / data around one async action
useDebouncedCallback — debounce calling a function
useFields — small form object, optional Zod-shaped schema
useList — insert, update, remove, reorder by id
useSelection — single or multi select ids
useSearchState — URL search params as React state
useConfirm — await a yes/no dialog
usePrompt — await a string from a dialog
useControllableState — controlled and uncontrolled in one setter
useUnsavedChanges — tab-close warning and in-app leave confirm
useElementSize — element size via ResizeObserver
useInView — element vs viewport via IntersectionObserver
usePagination — page, offset, next/prev with clamping
Confirm, prompt, and overlay hooks return a render() function — mount it once in the tree.

useFields accepts an optional Zod-shaped safeParse schema. Zod is not a package dependency.

Package
ESM + CJS + generated TypeScript types
MIT License
Author: [Senthil Kumar Thangavel](https://senthilkumar.mentorbridge.in/)