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

reactivity-store

v0.4.0

Published

a reactive store, make you write reactive logic in react app just like zustand

Readme

🚀 RStore

Vue-inspired Reactive State Management for React

Deploy npm downloads

Bring Vue's reactivity system to React with zustand-like simplicity. Direct mutation, automatic UI updates - no manual subscriptions needed!

Documentation · Getting Started · Examples


Why RStore?

  • 🎯 Direct Mutation - No setState, just mutate and UI updates automatically
  • Vue Reactivity - Use ref(), reactive(), computed() from @vue/reactivity
  • 🪝 Zustand-like API - Clean, minimal API design
  • 🔌 Built-in Middleware - Persist, actions, Redux DevTools out of the box
  • 📘 TypeScript First - Full type safety and excellent IntelliSense
  • 🚀 Zero Boilerplate - No reducers, no dispatch, no manual subscriptions

Installation

npm install reactivity-store
# or
pnpm add reactivity-store

Quick Start

🟢 Vue Approach

For Vue developers or those wanting fine-grained reactivity:

import { createStore, ref, computed } from "reactivity-store";

const useCounter = createStore(() => {
  const count = ref(0);
  const doubled = computed(() => count.value * 2);

  const increment = () => count.value++; // Direct mutation!

  return { count, doubled, increment };
});

function App() {
  const { count, doubled, increment } = useCounter();
  return (
    <div>
      <p>Count: {count}</p>
      <p>Doubled: {doubled}</p>
      <button onClick={increment}>+1</button>
    </div>
  );
}

🔵 React Approach

For React developers who want simplicity without learning Vue APIs:

import { createState } from "reactivity-store";

const useCounter = createState(
  () => ({ count: 0 }),
  {
    withActions: (state) => ({
      increment: () => state.count++,
      decrement: () => state.count--
    })
  }
);

function App() {
  const { count, increment, decrement } = useCounter();
  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={increment}>+1</button>
      <button onClick={decrement}>-1</button>
    </div>
  );
}

Two Approaches, One Library

| | 🟢 Vue Approach | 🔵 React Approach | |---|---------------|------------------| | Best for | Vue developers | React developers | | APIs | ref, reactive, computed | Plain objects + actions | | Features | Auto-computed, lifecycle hooks | Middleware: persist, DevTools | | Use | createStore | createState |

Built-in Middleware

💾 Persistent State

const useSettings = createState(
  () => ({ theme: "light", language: "en" }),
  {
    withPersist: "app-settings", // Auto-saves to localStorage
    withActions: (state) => ({
      setTheme: (theme) => state.theme = theme
    })
  }
);

🛠️ Redux DevTools

const useCounter = createState(
  () => ({ count: 0 }),
  {
    withNamespace: "Counter", // Shows up in Redux DevTools
    withActions: (state) => ({
      increment: () => state.count++
    })
  }
);

⚡ Performance Options

const useStore = createState(
  () => ({ nested: { count: 0 } }),
  {
    withDeepSelector: true,      // Track nested changes (default: true)
    withStableSelector: false,   // Stable selector for performance
    withActions: (state) => ({
      increment: () => state.nested.count++
    })
  }
);

Advanced Features

Lifecycle Hooks

import { createStoreWithComponent, ref, onMounted, onUnmounted } from "reactivity-store";

const Timer = createStoreWithComponent({
  setup: () => {
    const seconds = ref(0);
    let timer;

    onMounted(() => {
      timer = setInterval(() => seconds.value++, 1000);
    });

    onUnmounted(() => {
      clearInterval(timer);
    });

    return { seconds };
  }
});

function App() {
  return <Timer>{({ seconds }) => <div>{seconds}s</div>}</Timer>;
}

Component-local Reactive State

import { useReactiveState } from "reactivity-store";

function TodoList() {
  const [state, setState] = useReactiveState({
    todos: [],
    filter: "all"
  });

  const addTodo = (text) => {
    setState((s) => {
      s.todos.push({ id: Date.now(), text, done: false });
    });
  };

  return <div>{/* ... */}</div>;
}

State Subscriptions

const useCounter = createState(
  () => ({ count: 0 }),
  { withActions: (s) => ({ increment: () => s.count++ }) }
);

// Subscribe anywhere in your app
useCounter.subscribe(
  (state) => state.count,
  () => console.log("Count changed:", useCounter.getReadonlyState().count)
);

Comparison

Traditional React

const [count, setCount] =
  useState(0);

setCount(prev => prev + 1);

RStore (Vue Approach)

const count = ref(0);

count.value++;

RStore (React Approach)

const useCount = createState(
  () => ({ count: 0 }),
  { withActions: (s) => ({
    increment: () => s.count++
  })}
);

API Overview

| API | Purpose | |-----|---------| | createStore | Vue-style reactive stores with ref(), reactive(), computed() | | createState | React-style state with actions and middleware | | createStoreWithComponent | Component-scoped stores with lifecycle hooks | | useReactiveState | Component-local reactive state (like useState but reactive) | | useReactiveEffect | Side effects with automatic dependency tracking |

Documentation

Visit https://mrwangjusttodo.github.io/r-store/ for complete documentation:

License

MIT © MrWangJustToDo