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

xredux

v1.0.2

Published

An upgrade for redux

Readme

XRedux

npm version build status coverage status npm downloads license

An upgrade for redux. Inspired by dva and mirrorx.

XRedux is not a framework like dva and mirrorx. It's just a plain libray and it solves the two problems that redux brought about.

  1. Following redux rules, we need create actions、reducers even more files. This will lead to mental leap.
  2. Redux didn't solve the async action.

So We need a higher abstraction. There are already better solutions to these two problems. Such as dva propose model concept to solve the problems which we should create many files. For the async action problem, dva use saga and mirrorx use redux-thunk. I think redux-thunk is better which we can use async/await to write code. So XRedux is a libray combining the two ideas. It's just a plain libray the same as redux. It can be used in any framework.

Installation

npm install --save xredux

Usage

import xredux from "xredux";

// Create a Redux store holding the state of your app.
// Its API is the same as redux store, { subscribe, dispatch, getState }
const store = xredux.createStore();

// xredux.actions contain all actions in the store.
const actions = xredux.actions;

// This is a model, a pure object with namespace, initialState, reducers, effects.
xredux.model({
  namespace: "counter",
  initialState: {
    count: 0
  },
  reducers: {
    add(state, action) {
      return {
        ...state,
        count: state.count + 1
      };
    },
    plus(state, action) {
      return {
        ...state,
        count: state.count - 1
      };
    }
  },
  effects: {
    async addAsync(action, dispatch, getState) {
      await new Promise(resolve => {
        setTimeout(() => {
          resolve();
        }, 1000);
      });
      // Dispatch action with xredux.actions
      actions.counter.add();

      // You can aslo use `dispatch` action
      // dispatch({ type: "counter/add" });

      // You even can use built-in `setState` reducer
      // const { count } = getState().counter;
      // actions.counter.setState({ count: count + 1 });
    }
  }
});

store.subscribe(() => console.log(store.getState()));

// Dispatch action with xredux.actions
// xredux.actions contain all action in the store
// xredux.actions = { [namespace]: { ...reducers } }
actions.counter.add(); // store.getState() => { counter: { count: 1 } }

actions.counter.plus(); // store.getState() => { counter: { count: 0 } }

// Dispatch async action
actions.counter.addAsync(); // store.getState() => { counter: { count: 1 } }

// You can aslo use `dispatch` action
// dispatch({ type: [namespace]/[reducer] })
store.dispatch({ type: "counter/add" }); // store.getState() => { counter: { count: 2 } }
store.dispatch({ type: "counter/addAsync" }); // store.getState() => { counter: { count: 3 } }

Documentation

Examples

License

MIT