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

store2state

v0.1.1

Published

This library provides a robust and flexible state management solution for JavaScript and TypeScript applications, with a focus on React integration. It includes a powerful Store class, custom hooks for React, and an AsyncAction utility for handling asynch

Readme

⚡ store2state

Open Project Lab Submission

store2state is a robust and flexible state management library for JavaScript and TypeScript, designed with a focus on React integration and easy extensibility to other frameworks.
It provides a powerful Store class, AsyncAction utility for async flows, and custom React hooks for reactive state access.


🎃 Hacktoberfest 2025

🎉 store2state is participating in Hacktoberfest 2025!
Whether you’re new to open source or an experienced TypeScript dev — we’d love your contributions!

We’ve labeled issues with:

  • good first issue → beginner-friendly
  • help wanted → community support needed
  • hacktoberfest → counts toward Hacktoberfest contributions

💡 All merged, approved, or hacktoberfest-accepted pull requests will count for Hacktoberfest 2025!


🧩 How to Contribute

  1. Star this repo 🌟
  2. Fork and clone it locally
  3. Pick an issue labeled good first issue or help wanted
  4. Create a feature branch
  5. Make your change (bug fix, doc update, new feature)
  6. Open a Pull Request with a clear description

You can also propose new ideas or file improvement issues!


🪄 Great Starter Ideas

Here are a few easy and impactful ways to contribute:

  • 🧠 Docs: Improve README examples or add JSDoc comments
  • 🧩 React Hooks: Add a hook for derived/computed state
  • 🧪 Testing: Add unit tests for the Store or AsyncAction classes
  • 🧰 TypeScript: Improve generic types for better inference
  • ⚙️ New Feature: Add createVueStore or createSvelteStore wrappers
  • 🪶 Performance: Optimize shallow comparison logic

🚀 Features

  • De-centralized state management with subscriptions
  • Efficient state updates with shallow comparison
  • React hooks for easy integration (useStore, useStoreSelector)
  • Asynchronous action handling with status tracking and cancellation
  • TypeScript support for type-safe state management

📦 Installation

npm install store2state

🧭 Usage

Creating a Store

import { createStore } from 'store2state';

const initialState = { count: 0 };
const store = createStore(initialState);

Using the Store in React

import { useStore } from 'store2state';

function Counter() {
  const { get, set } = useStore(store);
  
  return (
    <div>
      <p>Count: {get().count}</p>
      <button onClick={() => set(state => ({ count: state.count + 1 }))}>
        Increment
      </button>
    </div>
  );
}

Using Selectors

import { useStoreSelector } from 'store2state';

function CountDisplay() {
  const count = useStoreSelector(store, state => state.count);
  return <p>Count: {count}</p>;
}

Async Actions

import { createAsyncAction, Status } from 'store2state';

const fetchUserAction = createAsyncAction(store, async (store, setStatus, userId) => {
  setStatus(Status.LOADING);
  try {
    const response = await fetch(`/api/users/${userId}`);
    const user = await response.json();
    setStatus(Status.SUCCESS, user);
    return user;
  } catch (error) {
    setStatus(Status.ERROR, error);
    throw error;
  }
});

📘 API Reference

(unchanged — your original section here)


🧩 Roadmap

  • [ ] Decouple React integration into @store2state/react
  • [ ] Add framework-agnostic hooks (Vue, Svelte, Solid)
  • [ ] Add unit tests and benchmarks
  • [ ] Add middleware support (e.g., for logging or persistence)

🤝 Contributing

Pull requests are welcome! Before submitting:

  • Ensure your code is formatted with prettier
  • Include tests for new features
  • Update or improve documentation if applicable

📜 License

This project is licensed under the MIT License.