npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nimoh-digital-solutions/tast-hooks

v1.2.6

Published

Reusable React hooks for tast projects

Readme

@nimoh-digital-solutions/tast-hooks

Reusable React hooks for the TAST ecosystem. Zero-config, SSR-safe, and fully typed.

npm

Installation

npm install @nimoh-digital-solutions/tast-hooks
# or
yarn add @nimoh-digital-solutions/tast-hooks

Peer dependencies

| Package | Version | |---|---| | react | ^18 \|\| ^19 |

Hooks

useLocalStorage<T>(key, initialValue)

useState that persists to localStorage. Handles SSR, quota errors, and JSON serialization automatically.

const [theme, setTheme, writeError] = useLocalStorage('theme', 'light');

| Parameter | Type | Description | |---|---|---| | key | string | localStorage key | | initialValue | T | Fallback value if key is missing |

Returns [value, setValue, writeError]writeError is a string if the last write failed (e.g. quota exceeded).


useDebounce<T>(value, delay)

Debounces a rapidly changing value. Useful for search inputs, resize handlers, etc.

const [search, setSearch] = useState('');
const debouncedSearch = useDebounce(search, 300);

useEffect(() => {
  fetchResults(debouncedSearch);
}, [debouncedSearch]);

useDocumentTitle(title, appName?)

Sets document.title and restores it on unmount. Announces the title change to screen readers via an aria-live region.

useDocumentTitle('Dashboard');
// → document.title = "Dashboard — My App"

useMediaQuery(query)

Reactive CSS media query match. SSR-safe (returns false on the server).

const isMobile = useMediaQuery('(max-width: 768px)');
const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');

useClickOutside<T>(ref, handler)

Fires a callback when a pointerdown event occurs outside the referenced element. Ideal for closing dropdowns and modals.

const menuRef = useRef<HTMLDivElement>(null);
useClickOutside(menuRef, () => setOpen(false));

useWindowSize()

Live window dimensions, debounced at 100 ms. SSR-safe (returns 0 × 0 on the server).

const { width, height } = useWindowSize();

Returns WindowSize{ width: number; height: number }.


usePrevious<T>(value)

Returns the value from the previous render.

const prevCount = usePrevious(count);

useToggle(initial?)

Boolean state with memoized helpers.

const [isOpen, toggle, open, close] = useToggle(false);

Returns [value, toggle, setTrue, setFalse].


useToast()

Manages a queue of auto-dismissing toast notifications.

const { toasts, addToast, dismissToast } = useToast();

addToast({ message: 'Saved!', variant: 'success' });

| Property | Type | Description | |---|---|---| | toasts | ToastItem[] | Current visible toasts | | addToast | (options) => string | Add a toast, returns its ID | | dismissToast | (id) => void | Manually dismiss a toast |


useNetworkStatus() / useIsOnline()

Reactive online/offline detection using useSyncExternalStore.

const { isOnline, since } = useNetworkStatus();
const isOnline = useIsOnline(); // shorthand boolean

TypeScript

All hooks export their associated types:

import type { WindowSize, ToastItem, ToastVariant, NetworkStatus } from '@nimoh-digital-solutions/tast-hooks';

Development

This package lives in the TAST monorepo.

yarn packages:build   # Build all packages
yarn test             # Run tests (Vitest)

License

MIT