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

react-statelet

v1.0.1

Published

Checkout https://github.com/eldhose1308/react-statelet

Downloads

7

Readme

🧠✨ Introducing React-Statelet

Checkout https://github.com/eldhose1308/react-statelet

A lightweight state management tool for React that sits perfectly between simplicity and power.


Why React-Statelet?

You start building a React app. It's simple at first—just a few components and some local state. Nothing fancy.

But as the app grows, the state starts needing to move around.
You lift it up. Then you pass it down. Then you pass it way down.
Suddenly, you're deep in prop drilling land.

So you reach for Context to make things cleaner.
It works... until one small state change causes the whole tree to re-render.
Not great.

Then comes the thought:
"Should I just use Redux?"

But Redux? That’s a whole setup—action types, reducers, boilerplate everywhere.
It feels like overkill for what you need.


You just want something that:

  • ✅ Shares state across components
  • ✅ Doesn't cause unnecessary re-renders
  • ✅ Is easy to use and doesn't take over your project

That’s exactly why we made React-Statelet

It’s a small pattern that sits right in the middle:

  • 🪶 Lighter than Redux
  • 🧠 Smarter than plain Context
  • 🛠️ Way easier than lifting state all over the place

With React-Statelet, you get:

  • 🏗️ A simple store with your reducer and initial state
  • 🧵 Easy dispatch hooks
  • 💾 Optional localStorage persistence
  • 🎯 Fine-tuned subscriptions that only re-render what’s needed

No magic. No fuss.
Just enough structure to keep your state clean without getting in your way.

If that sounds like what you’ve been missing—give React-Statelet a try.


🌟 Features

✅ 1. Minimal Boilerplate

Create a store with just a reducer and initial state.
No provider nesting or complex setup.

const isLoading = useStatelet(state => state.loading);

⚡ 2. Fine-Grained Reactivity via Selectors

Efficient state subscription using useSyncExternalStore and selectors means components only re-render when the selected part of the state changes.

const status = useStatelet(state => state.status);

status-toggle-selector

🚀 3. Easy Dispatch Functions

Create action dispatchers on the fly with useCreateStateletAction:

const increment = useCreateStateletAction('INCREMENT');
increment();

easy-dispatching

💾 4. Persistent State Support

Preserve state across reloads using localStorage and a flexible whitelist:

persistConfig: {
  key: "appState",
  whitelist: ["todos", "theme"]
}

persist-storage

Statelet restores only what you care about, automatically.

🧱 5. Composable and Scalable

You can define multiple stores or slice reducers and mount them under a unified store, giving you modularity if you need it later.

scalabale The form being in a sub store context and only the selectors using these states will re-render

🧪 Try It Out

Lightweight, reactive, and just the right amount of structured. React-Statelet is the missing piece in your React state toolkit.

🚀 Getting Started

Follow these simple steps to set up React-Statelet in your React project.

1. Install React-Statelet

npm install react-statelet

2. Create Your Store

Define your reducer and initial state in a new file (e.g. store.js):

const initialState = {
  count: 0,
  loading: false,
};

function reducer(state, action) {
  switch (action.type) {
    case 'INCREMENT':
      return { ...state, count: state.count + 1 };
    case 'SET_LOADING':
      return { ...state, loading: action.payload };
    default:
      return state;
  }
}

3. Wrap Your App with StateletProvider

// App.jsx
import React from 'react';
import { StateletProvider } from 'react-statelet';
import Counter from './Counter';

const persistConfig = {
  key: 'my-main-app-store',
  whitelist: ['count']
};

const storeValue = {
  initialState, reducer
}

function App() {
  return (
    <StateletProvider value={storeValue}>
      <Counter />
    </StateletProvider>
  );
}

export default App;

4. Use State and Dispatch in Components

Now use your state and actions in any component:

// Counter.jsx
import React from 'react';
import { useCreateStateletAction, useStatelet } from "react-statelet";

function Counter() {
  const count = useStatelet(state => state.count);
  const increment = useCreateStateletAction('INCREMENT');

  return (
    <div>
      <h2>Count: {count}</h2>
      <button onClick={increment}>Increment</button>
    </div>
  );
}

export default Counter;

5. (Optional) Enable Local Storage Persistence

Pass a persistConfig to enable persistence:


const persistConfig = {
  key: 'my-main-app-store',
  whitelist: ['count']
};

const storeValue = {
  initialState, reducer
}

function App() {
  return (
    <StateletProvider value={storeValue}>
      <Counter />
    </StateletProvider>
  );
}

Now you're all set! Statelet is now managing your app’s state—without boilerplate, over-renders, or complexity.