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

@octanejs/zustand

v0.1.55

Published

zustand bindings for the octane renderer — reuses zustand's framework-agnostic vanilla store and swaps the React binding for octane's useSyncExternalStore.

Readme

@octanejs/zustand

zustand for the octane UI framework.

Installation

npm install @octanejs/zustand
pnpm add @octanejs/zustand

zustand separates a framework-agnostic vanilla store (createStore) from a tiny React binding (create + useStore) built on useSyncExternalStore. This package reuses the vanilla store unchanged (re-exported verbatim from zustand/vanilla) and reimplements only the binding on top of octane's useSyncExternalStore. The public surface matches zustand 1:1 — most zustand code works by changing the import.

// before
import { create } from 'zustand';
// after
import { create } from '@octanejs/zustand';

const useBearStore = create((set) => ({
  bears: 0,
  increase: () => set((s) => ({ bears: s.bears + 1 })),
}));

function BearCounter() @{
  const bears = useBearStore((s) => s.bears);
  <h1>{bears as string} bears</h1>
}

Entry points

| import | what you get | notes | | --- | --- | --- | | @octanejs/zustand | create, useStore, createStore | the React binding, octane-bound | | @octanejs/zustand/vanilla | createStore + types | re-exported verbatim from zustand | | @octanejs/zustand/shallow | shallow, useShallow | shallow verbatim; useShallow octane-bound | | @octanejs/zustand/middleware | persist, devtools, subscribeWithSelector, combine, redux, createJSONStorage, … | re-exported verbatim (all framework-agnostic) | | @octanejs/zustand/traditional | createWithEqualityFn, useStoreWithEqualityFn | octane-bound (selector + equality fn) |

How it works

octane keys hooks by a compiler-injected per-call-site Symbol, appended as the last argument of every use* call. A custom hook is just a wrapper that forwards that slot to the base hook it composes — which is all useStore does. Because the slot is per-call-site, useBearStore(a) and useBearStore(b) in one component (or the same hook used twice) stay independent, exactly like in React.

Naming matters. The hook you call must follow the use* convention (const useBearStore = create(...)) so the compiler recognises it and injects the slot — this is the same use*-is-reserved-for-hooks rule React uses.

Selecting object slices — useShallow

A selector that returns a fresh object/array each call ((s) => ({ a: s.a })) never compares Object.is-equal, so it violates useSyncExternalStore snapshot stability and reaches the maximum update depth guard. Wrap it with useShallow to cache the selection by shallow equality:

import { useShallow } from '@octanejs/zustand/shallow';

function Sliced() @{
  const { a, b } = useBearStore(useShallow((s) => ({ a: s.a, b: s.b })));
  // re-renders only when a or b actually changes
}

Equality functions — traditional

For the equality-fn pattern, @octanejs/zustand/traditional provides createWithEqualityFn / useStoreWithEqualityFn:

import { createWithEqualityFn } from '@octanejs/zustand/traditional';
import { shallow } from '@octanejs/zustand/shallow';

const useStore = createWithEqualityFn((set) => ({ a: 0, b: 0 }), shallow);
const { a } = useStore((s) => ({ a: s.a })); // bails out via shallow

For most object-slice selections, prefer useShallow — the v5-recommended approach.

Status

Current scope, known divergences, and verification status are tracked in the generated bindings status table, sourced from this package's status.json.