Socket
Socket
Sign inDemoInstall

react-promise-loader

Package Overview
Dependencies
8
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-promise-loader

This is a NPM package with a component for React that will help you display the loader at use react-promise-tracker


Version published
Weekly downloads
117
decreased by-23.03%
Maintainers
1
Install size
183 kB
Created
Weekly downloads
 

Readme

Source

react-promise-loader

Version Build Coverage Minified size Downloads PRs Welcome Tested with jest

Table of contents

Installation

You need to install promise loader and promise tracker packages:

npm install react-promise-loader react-promise-tracker

You can use yarn:

yarn add react-promise-loader react-promise-tracker

Getting started

Wrap promises that you would like to track as in the following example:

+ import { trackPromise} from 'react-promise-tracker';
//...

+ trackPromise(
    fetchUsers(); // You function that returns a promise
+ );

Then you need to add the Loader component and send data from the react-promise-tracker:

+ import { usePromiseTracker } from 'react-promise-tracker';
+ import Loader from 'react-promise-loader';

const App = () => (
  <div className="app">
    ...
+     <Loader promiseTracker={usePromiseTracker} color={'#3d5e61'} background={'rgba(255,255,255,.5)'} />
  </div>
);
export default App;

The settings of the component

ParameterTypeDescriptionDefault
backgroundstringSets the color for the background in any format that supports cssrgba(255,255,255,.5)
colorstringSets the color of the spinner#000
promiseTrackerbooleanYou need to set usePromiseTracker function from the react-promise-trackerfalse
loadingbooleanIf you need to run the loader without tracking promises you should set truefalse
zIndexnumberYou can change the z-index to distribute the layers correctly999

Contributing

Please read through our CONTRIBUTING.md.

Keywords

FAQs

Last updated on 28 Jun 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc