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

react-hoc-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hoc-loader

HOC (Higher Order Component) Loader for Redux Containers

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

React HOC Loader

HOC (Higher Order Component) Loader for Redux Containers

Nodei.co badge
Travis CI Build Status NPM version NPM downloads Dependency Status

Installation

yarn add react-hoc-loader

or

npm install react-hoc-loader

Usage

Component sits within the container and fires off a function in a similar way to which componentWillMount would.

An optional loading indicator can be passed from a state key to determine if a loading indicator should be displayed before rendering the intended component.

If there is no component, but you would like to display a simple text message, then pass undefined as the 4th argument and a string message as the 5th.

Example:

import { connect } from 'react-redux';
import HOCLoader from 'react-hoc-loader';
import LoadingScreen from './loading-screen';
import Component from './components';

const mapStateToProps = ({ reducer }) => ({
  // State key to determine if a load is in progress
  isLoading: reducer.isLoading
});

export const mapDispatchToProps = dispatch => ({
  onLoad() {
    // Function to fire off when container first loads
    dispatch({ type: 'LOADING_DATA' });
  },
});

...
const Container = connect(
  mapStateToProps,
  mapDispatchToProps,
)(HOCLoader(Component, 'onLoad', 'isLoading', LoadingScreen));

...

History

Discover the release history by heading on over to the releases page.

License

Unless stated otherwise all works are:

  • Copyright © 2018+ Reme Le Hane

and licensed under:

Keywords

FAQs

Package last updated on 03 Aug 2018

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