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

@faizaanceg/use

v0.1.0

Published

A tiny library of useful hooks

Downloads

78

Readme

@faizaanceg/use

A tiny library of useful React hooks.

Installation

npm install @faizaanceg/use @faizaanceg/pandora react react-dom

Hooks

useStore

A lightweight state management hook based on the reducer pattern. It allows you to define a "reducer factory" (an object where keys are action types and values are reducer functions) and automatically generates type-safe dispatch helpers.

Usage:

import { useStore } from "@faizaanceg/use/store";

// 1. Define your state type
type State = { count: number };

// 2. Create a reducer factory
// Keys become the action names on the returned 'mutations' object
const factory = {
  increment: (state: State, action: { payload: number }) => ({
    ...state,
    count: state.count + action.payload,
  }),
  decrement: (state: State, action: { payload: number }) => ({
    ...state,
    count: state.count - action.payload,
  }),
};

function Counter() {
  // 3. Initialize the store
  const [state, mutations] = useStore(factory, { count: 0 });

  return (
    <div>
      <p>Count: {state.count}</p>
      {/* 4. Call generated mutations directly */}
      <button onClick={() => mutations.increment(1)}>Increment</button>
      <button onClick={() => mutations.decrement(1)}>Decrement</button>
    </div>
  );
}

useKV

A hook to subscribe to a key in a KeyValueStore (from @faizaanceg/pandora). It updates the component whenever the key's value changes, even across tabs (if supported by the storage backend).

Requirement: You must wrap your application (or part of it) in a KVProvider to provide the KeyValueStore instance.

Usage:

import { KeyValueStore } from "@faizaanceg/pandora/kv";
import { KVProvider, useKV } from "@faizaanceg/use/kv";

// 1. Initialize the KeyValueStore (e.g., using localStorage)
const store = new KeyValueStore(localStorage);

function App() {
  return (
    <KVProvider kv={store}>
      <ThemeComponent />
    </KVProvider>
  );
}

function ThemeComponent() {
  // 2. Subscribe to a key. The component re-renders on change.
  // You can provide a default value as the second argument.
  const theme = useKV<string>("theme", "light");

  return <div>Current theme: {theme}</div>;
}

useKVWith

A hook to subscribe to a key in a KeyValueStore by passing the store instance directly. Useful when you cannot use KVProvider or need to access a specific store instance.

Usage:

import { KeyValueStore } from "@faizaanceg/pandora/kv";
import { useKVWith } from "@faizaanceg/use/kv";

const store = new KeyValueStore(sessionStorage);

function ThemeComponent() {
  const theme = useKVWith<string>("theme", "light", store);

  return <div>Current theme: {theme}</div>;
}