Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-nprogress

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-nprogress

Redux NProgress

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

🔨 WIP: Redux NProgress

Redux Middleware, Reducer, Component & Actions for the most popular progress bar.

Tests will be available soon.

Demo

Installation

npm i --save redux-nprogress

Usage

Middleware

Import the nprogressMiddleware and include it in applyMiddleware when creating the Redux store.

Example store:

import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import { nprogressMiddleware } from 'redux-nprogress';
import promiseMiddleware from 'redux-promise-middleware';
import rootReducer from 'reducers/index';

const store = createStore(
  rootReducer,
  applyMiddleware(
    thunk,
    nprogressMiddleware(),
    promiseMiddleware(),
    createLogger()
  )
);

export default store;

Reducer

Import reducer and assign it to the nprogress key in your root reducer.

Example root reducer:

import { combineReducers } from 'redux';
import { nprogress } from 'redux-nprogress';
import posts from './posts';

const rootReducer = combineReducers({
  posts,
  nprogress
});

export default rootReducer;

Actions

To use the middleware, dispatch an action with nprogress property.

export function loadPosts() {
  return {
    type: 'LOAD_POSTS',
    nprogress: [
      'LOAD_POSTS_FULFILLED',
      'LOAD_POSTS_REJECTED'
    ],
    payload: ... // Your application specific promise middleware
  };
}

Component

Add NProgress component to the root component of your application.

Example:

import React from 'react';
import { NProgress } from 'redux-nprogress';
import Header from 'components/Header';

export default function App({ children }) {
  return (
    <div>
      <NProgress />
      <Header />

      { children }

    </div>
  );
}

More docs will be available soon. For now just check the source.

Keywords

FAQs

Package last updated on 24 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc