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-redux-hoc-loader

v1.1.1

Published

Loader HOC for React with reducer for Redux

Readme

NPM

react-redux-hoc-loader

React-Redux HOC and Reducer for managing status of loaders in redux state

Install

npm install --save react-redux-hoc-loader

Usage

Step 1: Add loaders reducer to list of your reducers.

// index.js
import { createStore, combineReducers } from "redux";
import { Provider } from "react-redux";
import { reducer as loadersReducer } from "react-redux-hoc-loader";

const store = createStore(
  combineReducers({
    /* your reducers here */
    loaders: loadersReducer
  })
);

const Root = () => (
  <Provider store={store}>
    <App />
  </Provider>
);

Step 2: Wrap your component with withLoading high order component and pass names of loaders as arguments.

// component.js
import withLoading from "react-redux-hoc-loader";

const LOADER_NAME = "example";

const CustomComponent = ({ loaders, ...props }) => {
  const loader = loaders[LOADER_NAME];
  return (
    <>
      <p>Loader status: <b>{loader.status ? "loading..." : "done"}</b></p>
      <button onClick={() => loader.start()}>Start loading</button>
      <button onClick={() => loader.stop()}>Stop loading</button>
    </>
  );
};

export default withLoading(LOADER_NAME)(CustomComponent);

HOC provides loaders property to your component. You can get object of concrete loader by loaders["NAME_OF_YOUR_LOADER"].

Each object contains following properties for working with loader:

| Property | Type | Description | |:--------------|:--------------|:--------------| | status | boolean | Status of you loader | | start | function | Method for start of a loader.Can receive async or not callback as a first argument.See Options of Usage to get more details. | | stop | function | Method for stop of a loader |

Options of Usage

1. You can push more that one loader name to HOC:

withLoading("firstLoader", "secondLoader" /*, ... */)(Component)

2. You can pass your async callback and arguments for it to start method of loader. In this case loader will be started before the start and stopped after the end of your callback Example of usage start function with async callback:

  // async callback 
  loader.start(fetch, "/smth", { method: "DELETE" })
  // sync callback
  loader.start(console.log, "smth")

3. If you want to start/stop loaders from your action creators, "react-redux-hoc-loader" provides functions startLoading and stopLoading to manage it:

import { startLoading, stopLoading } from "react-redux-hoc-loader";

const LOADER_NAME = "example";

export const asyncAction = async dispatch => {
  dispatch(startLoading(LOADER_NAME));
  /* your async code, e.g.: */
  await fetch("/smth");
  /* end of async code */
  dispatch(stopLoading(LOADER_NAME));
}

License

This project is licensed under the terms of the MIT license.