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

@zap-studio/store-react

v1.0.0

Published

React bindings for @zap-studio/store: a useStore hook that subscribes to a createStore/derive instance.

Readme

@zap-studio/store-react

React bindings for @zap-studio/store: a single useStore hook that subscribes a component to a createStore/derive instance.

Full documentation: zapstudio.dev/store/react

Motivation

Zustand's React binding needs a selector plus a manual shallow equality check to avoid extra re-renders, because Zustand's own state has no built-in way to cache a derived value. @zap-studio/store already solves that at the source with derive — a computed value that is auto-tracked and cached, and only changes reference when it actually changes.

@zap-studio/store-react stays deliberately thin: one hook, built on React's own useSyncExternalStore, that reads whatever @zap-studio/store gives it. No middleware, no context Provider, no shallow-equality helper to reach for — build the exact value your component needs with derive, then subscribe to it.

Installation

npm install @zap-studio/store-react @zap-studio/store

Features

  • One hook: useStore(store, selector?) — nothing else exported.
  • Works with both: a createStore instance, or a derive value.
  • Built on useSyncExternalStore — safe under React's concurrent rendering, no custom subscription-in-useEffect code.
  • selector is optional and narrows the subscribed value; the component only re-renders when the selected result changes, compared with Object.is.

Quick Start

import { createStore, derive } from "@zap-studio/store";
import { useStore } from "@zap-studio/store-react";

const counter = createStore({ count: 0 }, (set) => ({
  increment: () => set((s) => ({ count: s.count + 1 })),
}));

function Counter() {
  const count = useStore(counter, (s) => s.count);
  return <button onClick={() => counter.get().increment()}>{count}</button>;
}

Without a Selector

useStore(store) re-renders on every change to store — both createStore and derive results are cached internally, so this is safe either way, it just re-renders on more changes than a selector would:

const isEven = derive([counter], (s) => s.count % 2 === 0);

function Parity() {
  const even = useStore(isEven);
  return even ? "even" : "odd";
}

To avoid re-rendering on changes your component doesn't care about, pass a selector, or build the exact value you need with derive first.

Runtime Support

| Runtime | Minimum version | | -------- | ------------------------------------------------ | | React | 18.0.0 | | Node.js | 18.0.0 | | Bun | 1.0.0 | | Deno | 1.42 | | Browsers | Latest evergreen (Chrome, Edge, Firefox, Safari) |

License

MIT