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

v1.0.0

Published

A simple state management system for building reactive user interfaces

Readme

react-zine

react-zine is a simple state management system for building reactive user interfaces with React. It's built on top of the tiny publisher/subscriber system zine. It aims to be small (zine and react-zine together are about 3kb unminified), performant and much easier to use than most state management systems for React. Using react-zine you can easily externalize state (i.e. pull state data out of this.setState and manage it independently of your components) and reactively inject updates into arbitrary locations in the hierarchy. An updated tutorial is coming soon.

Installation

To install (using npm):

npm install react-zine --save

API Documentation

In addition to its two main exports (described below), react-zine re-exports issue, publish, publishable, subscribe and unsubscribe from zine, which means you only need to import one module to use it.

Usage: import {Connector, connect, publish, subscribe, issue, unsubscribe, unsubscribeAll, publishable} from 'react-zine';


Connector

Connector is a react wrapper component. It takes three props: source (any publishable subject, i.e. an object or function), render (a function of two arguments that determines what Connector renders) and passProps (an optional object of additional props to pass along at render time). The source argument is passed along as the first argument to the render prop whenever Connector renders. So for instance:

<Connector source={StoreInstance} passProps={{foo: 'bar'}} render={(store, props) => (
  <SomeOtherComponent {...props} value={store.value} />
  )} />

Will render <SomeOtherComponent foo='bar' value={StoreInstance.value} />. The useful feature of Connector is that it automatically manages a subscription to whatever is provided to its source prop and re-renders whenever that is published. So the above component will re-render (in place, without affecting the rest of the component hierarchy) whenever StoreInstance is published from anywhere in the application, which makes it easy to inject state updates anywhere in the component hierarchy.

If Connector unmounts or is re-rendered from above with a new source prop, it will automatically cancel its former subscription (and create a new one if necessary).


connect(source, render)

connect provides syntax sugar for a common use of Connector, and is implemented as follows:

export function connect (source, render) {
  return (props) => <Connector source={source} render={render} passProps={props} />;
}

This enables an extremely concise way to define pure functional components that subcribe to static sources, e.g.

const InputStore = {value: ''};
const Input = connect(InputStore,
  (store, props) => <input type="text" value={store.value} onInput={(event) => issue(store, {value: event.target.value})} />
);

...will define a managed input component that tracks and updates the value field from the object InputStore.

Recent changes

Version 1.0

This is the first release of react-zine. The functionality provided by this module used to be a part of the main zine package, but this update factors React-specific functionality into a separate package (this one) and renames the two main exports so that the connect function takes the common imperative form for functions, while the Connector class takes the common noun form.

License

MIT