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

v0.0.1

Published

A higher order component for encapsulating Redux apps

Readme

React Dendrimer

Version Coverage Build Status

React dendrimer is a higher order component which allows for encapsulation of react-redux apps as controlled components within a larger react application.

Installation:

npm install --save react-dendrimer

Why Do I Need This?

There's a good chance you don't! Composition in redux is intended to happen at the reducer level, however there are some cases where you may need to isolate "sub-apps" as individual components in a larger application (see https://redux.js.org/recipes/isolating-subapps).

A problem arises when you need to communicate between "sub-apps", as they are each their own source of truth! The best solution would be to join all "sub-apps" that need to communicate with eachother under a single store through reducer composition, however this isn't always a realistic possibility.

React dendrimer provides a simple solution for working with and communicating between redux "sub-apps" without sacrificing one-way data flow, by allowing you to wrap entire redux apps as controlled components -- just like you would a form input!

Example usage

Let's create a controlled redux app component (dendrimer) from a redux application with a simple state tree:

import { Component } from 'react';
import Dendrimer from 'react-dendrimer';
import { SubAppRootComponent, reducer, myCustomMiddleware } from './subApp';

export default class SubAppDendrimer extends Component {
    constructor(props) {
        super(props);

        this.state = {
            subAppState: {
                foo: true,
                bar: true
            }
        };
    }

    render() {
        return (
            <Dendrimer
                onChange={this.handleSubAppChange}
                reducer={reducer}
                state={this.state.subAppState}
            >
                <SubAppRootComponent />
            </Dendrimer>
        );
    }

    handleSubAppChange(subAppAction, newSubAppState) {
        this.setState({
            subAppState: newSubAppState
        });
    }
}

Each time an action dispatched within the "sub-app" would cause its state to change, the action and new state is instead provided to our callback handleSubAppChange. From here we can register the new state into our component state, and let it flow back into the "sub-app" through the state prop on Dendrimer.

Notably, the state tree of the "sub-app" store is not updated until the state flows back in through the state prop on Dendrimer, so the "sub-app" is in effect "controlled" by this outer component.

If our "sub-app" is dependent on some middleware (or store enhancer), we can add it to the Dendrimer by modifying the above example:

    render() {
        return (
            <Dendrimer
                enhancer={applyMiddleware(myCustomMiddleware)}
                onChange={this.handleSubAppChange}
                reducer={reducer}
                state={this.state.subAppState}
            >
                <SubAppRootComponent />
            </Dendrimer>
        );
    }

This way we can preserve the full functionality of the "sub-app" while ensuring it's state is controlled by the main app.

Note: The "sub-app" is still responsible for its own side-effects! Logging, ajax requests, etc performed by the "sub-app" will not be prevented by the dendrimer.

Contributions

Anyone is welcome to contribute to this package. My only "rule" is that your contribution must either pass the existing unit tests, or include additional unit tests to cover new functionality.

Here are some commands that may be helpful for development:

  • npm test: Runs the unit tests
  • npm run build: Builds the library

License

MIT