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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@simplestack/store

v0.7.1

Published

A simple storage solution for React

Readme

Simple Store

I fixed Zustand's BIGGEST problem

A simple, select-xcellent state management library for React.

The goal: make a storage solution as powerful as Zustand or Redux, without complicated functions to set and select state.

Here's an overview of how stores are created, and how you can operate on parts of a store using .select():

import { store } from "@simplestack/store";
import { useStoreValue } from "@simplestack/store/react";

// Define your store with an initial state
const documentStore = store({
  title: "Untitled",
  authors: ["Ada", "Ben"],
  meta: {
    pages: 3,
    tags: ["draft", "internal"],
  },
});

function Document() {
  // Update your UI with the store's current state
  const { title, meta: { tags } } = useStoreValue(documentStore);
  return (
    <div>
      {title} {tags.join(", ")}
    </div>
  );
}

// Or, select parts of a store to listen to individually
const titleStore = documentStore.select("title");
const tagsStore = documentStore.select("meta").select("tags");

function Title() {
  // And scope updates with selected stores for fine-grained control
  const title = useStoreValue(titleStore);
  return (
    <input value={title} onChange={(e) => titleStore.set(e.target.value)} />
  );
}

API

store(initial)

Creates a store with get, set, subscribe, and (for objects and arrays) select.

  • Parameters: initial: number | string | boolean | null | undefined | object
  • Returns: Store<T> where T is inferred from initial or supplied via generics
import { store } from "@simplestack/store";

const counter = store(0);
counter.set((n) => n + 1);
console.log(counter.get()); // 1

// Select parts of a store for objects and arrays
const doc = store({ title: "x" });
const title = doc.select("title");

React

useStoreValue(store)

A React hook to subscribe to a store and get its current value.

  • Parameters: store: Store<T> | undefined
  • Returns: T | undefined
import { store } from "@simplestack/store";
import { useStoreValue } from "@simplestack/store/react";

const counterStore = store(0);

function Counter() {
  const counter = useStoreValue(counterStore);
  return (
    <button onClick={() => counterStore.set((n) => n + 1)}>{counter}</button>
  );
}

Type Reference

These types are exported for TypeScript users.

  • StateObject: Record<string | number | symbol, any>
  • StatePrimitive: string | number | boolean | null | undefined
  • Setter: T | ((state: T) => T)
  • Store:
    • get(): T - Get the current value of the store.
    • set(setter: Setter<T>): void - Set the value directly or by using a function that receives the current state.
    • subscribe(callback: (state: T) => void): () => void - Subscribe with a callback. Returns an unsubscribe function.
    • select(key: K): Store<SelectValue<T, K>> (present only when T is an object or array) - Select a key or array index of the store. Returns a nested Store.
    • getInitial(): T - Get the initial state the store was created with. Used internally for SSR resume-ability.

Contributing

We are open to contributions! Before submitting your feature request, please read the CONTRIBUTING.md for our issue and PR process.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.