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-slim

v1.1.8

Published

An attempt to make a minimal react/redux library

Downloads

53

Readme

React-slim

Super small react-redux implementation (~200 lines,4KB minified)

I like to think of it as the unshitification of react :)

The main motivation to write this library was the shock and horror I felt when I noticed that the react library actually has a compiler and rust code that compiles to WASM etc. making me wonder why such a complex implementation was needed for such a simple design pattern.

What you get with this library

  • All the power of react and redux encapsulated into 7 simple functions
  • Powerful template-based rendering thanks to Mustache
  • Easy to debug - HTML tags to match your components, simple mapping via locators for tracing
  • Efficient,predictable re-renders
  • Modular structure - structure your application into multiple js bundles
  • De-coupled implementation that allows you to combine things the way you want to
  • Great performance
  • Use it directly in your browser, or via node - your choice.

What you don't get with this library

  • No magic - no hidden functionality, no side-effects => no surprises or unpredictable behavior
  • No bells and whistles - only one way to work with the library => no confusions
  • No developer "protection" - no parameter checking or safety checks => fast, tiny codebase

Installing react-slim

You can either install react-slim via npm and gang in your web application using

npm install react-slim

or

you can include it directly in your browser by including it along with the Mustache library

 <script src="https://cdn.jsdelivr.net/npm/[email protected]/mustache.min.js"></script>
 <script type=module">
    import { create_app, create_volume, create_element, create_binding, dispatch, action } from "https://cdn.jsdelivr.net/npm/react-slim@latest/dist/react-slim.min.js">
 </script>

Understanding react-slim

Concepts

The diagram below gives a good overview of the various concepts in react-slim and how they interact with each other

React-slim architecture

How the react-slim event loop works

  1. User interacts with a Element
  2. The Element triggers a Behavior
  3. The Behavior dispatches an Action
  4. The Action modifes a State
  5. The Volume managing the State triggers re-renders for Bindings that correspond to the State changes
  6. Each Binding triggers a re-render of the Element along with its Component at its Slot
  7. The Element renders itself using data(and State) from the Component into the Slot

Declarative UI updates

React-slim uses a declarative approach to UI updates. The state keys that you declare in the components and actions are what react-slim uses to decide which components to update in the UI.

The main goal of keeping the structure this way is to help developers easily understand which parts of the state affect a component, instead of having to dig through code to understand changes.

An additional goal is to allow for action definitions that modify state but do not need to trigger UI updates.

This also means that states do not have to be immutable.

Concept Re-usability

React-slim tries to keep its concepts as re-usable as possible.

  • Actions are not bound to anything and can be re-used across apps, volumes and bindings
  • Components can be re-used across Bindings, and therefore across Volumes and Apps
  • States can be re-used across Volumes (but make sure you dispatch actions appropriately for each volume that manages the state)

However, there is an exception

  • Elements are probably the least re-usable since they are bound to the app, and they need a globally unique element name since they are registered as custom HTML elements

Example app

An example usage of react-slim to create a simple app that demonstrates how to use react-slim is included in the repository, you can see it here

Example application

Opinionated/polarizing design choices

Here are some polarizing design choices I've made in the library. These are points you should seriously consider before adopting react-slim for large applications.

State change propagations are declarative, you'll need to declare state properties that your components depend on, and the properties that your actions modify. This was intentionally done to make it easier to understand component and action dependencies when reading your code, however it does introduce the complexity of manually updating these props when you modify actions or components.

ChatGPT pointed out to me that state propagation across volumes is a disadvantage and suggested centralized state management as an option. I decided to go against its suggestion because multiple volume state changes can easily be triggered by two or more actions on two or more different volumes. React-slim makes a trade-off on centralized state management and shoots for modular state because centralized state management involves complexities in desiging the state for large applications.

ChatGPT also pointed out that I don't use a virtual DOM for efficient updates to the UI, but on researching this topic, again, I found it unnecessary since react-slim only evaluates components whose state has changed, unlike React which evaluates the entire DOM tree on every state update.

How this library will evolve

I don't plan to change the functionality of the library at all. I think the world has too many libraries that change too fast, leaving developers always confused about the right way to build apps or features.

I am, however, open to performance improvements and bug-fixes

Using ChatGPT to generate react-slim apps

The cool thing about react-slim is that 150 lines of code can easily be sent to ChatGPT in a prompt to create react-slim modules and app.

You can use the text of the following file as a prompt to chatgpt. The instructions to ChatGPT are at the end of the file.

ChatGPT Prompt

Far from perfect though, so make sure you match the coding convensions followed in the example application above and edit ChatGPT's output for best results.

Author

Mahadevan K - [email protected]