Repository navigation
Releases: senthilkumar979/useThisHook
Release list
1.3.0
[1.3.0] - 2026-10-27
Added
useAsyncState— idle / loading / success / error with abort and optional immediate fetchuseOptimisticAction— optimistic update with rollback and duplicate-submit guarduseRetry— retries, constant or exponential backoff, and canceluseAsyncQueue— FIFO async tasks with a concurrency capusePolling— interval polling that pauses when the tab is hiddenuseOnlineQueue— in-memory outbox that flushes when the browser is onlineuseStorageQuota—navigator.storage.estimate()usage and quotauseInstallPrompt— PWAbeforeinstallpromptcapture andprompt()useCrossTabState— JSON state synced across tabs (BroadcastChannel + storage)useRenderTracker— render counts;console.debugin developmentuseWhyDidYouUpdate— log which snapshot keys changed between rendersuseKeyboardShortcut— window key combos with cleanupuseLongPress— mouse and touch press-and-hold handlersusethishook-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
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.0Playground: usethishook.mentorbridge.in
State
useSessionStorage— JSON state insessionStorage(same shape asuseLocalStorage)useThrottle— throttle a value (leading + trailing)
Browser
useScrollLock— lock / unlockdocument.bodyscroll for overlaysuseDocumentVisibility— Page Visibility API (visible|hidden)useIdle— true after a period of no user activity
App
useThrottledCallback— throttle a function, with canceluseUpdateEffect— likeuseEffect, but skips the initial mount
Forms
useAmountInput— optionallocalesmap to register or override separators beyond built-inen/de/nl/fr- Exported
AmountLocaleConfigtype
1.1.0
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
UseFingerprintOptionsUseFingerprintReturnFingerprintComponents
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
visitorIdas a soft signal. - Playground may also use separate commercial Fingerprint wiring for the site itself; that is not part of the
usethishookpackage 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
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
useThisHook v0.2.0
Five new browser hooks, plus playground navigation and docs polish.
Install
npm install usethishookPeer dependencies: React 18+ and React DOM 18+.
Added
Hooks
useEventListener— listen onwindow,document, a node, or a ref; handler stays current without re-subscribinguseTimeout— run a callback once after a delay; passnullto pauseuseHover—{ ref, isHovered }for pointer enter/leaveuseKeyPress—truewhile a key is held; ignores input, textarea, select, and contenteditableusePreferredColorScheme— OS'light' | 'dark'viaprefers-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
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/)