# @dock365/loading

> Loading HOC for react

Latest version **0.2.4** (published 2019-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dock365/loading
pnpm add @dock365/loading
yarn add @dock365/loading
bun add @dock365/loading
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2019-02-18 |
| First published | 2019-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hafeez Hamza |
| Maintainers | hafeez1042, justinmanjooran |
| Keywords | react, hoc, loading, fetching |

## Links

- npm: https://www.npmjs.com/package/@dock365/loading
- Repository: https://github.com/dock365/loading
- Homepage: https://github.com/dock365/loading#readme
- Issues: https://github.com/dock365/loading/issues
- npm.io page: https://npm.io/package/@dock365/loading

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2019-02-18
- 0.2.3 — 2019-02-18
- 0.2.2 — 2019-02-18
- 0.2.1 — 2019-02-18
- 0.2.0 — 2019-02-18
- 0.2.0-0 — 2019-02-18
- 0.1.0 — 2019-02-18
- 0.1.0-0 — 2019-02-18
- 0.0.7 — 2019-02-15
- 0.0.6 — 2019-02-15
- 0.0.5 — 2019-02-15
- 0.0.4 — 2019-02-15
- 0.0.3 — 2019-02-15
- 0.0.2 — 2019-02-15

## README

# Loading HOC
<!-- [![Build Status](https://travis-ci.org/codedock365/loading.svg?branch=master)](https://travis-ci.org/codedock365/loading) -->
[![npm Version](https://img.shields.io/npm/v/@dock365/loading.svg)](https://www.npmjs.com/package/@dock365/loading)


## Install
1 Install react confirm as dependency
  ```bash
  # Using yarn package manager
  $ yarn add @dock365/loading

  # Using npm package manager
  $ npm install --save @dock365/loading
  ```
2 Import React confirm module
  ```javascript
  // ES6
  import loading from "@dock365/loading"

  // ES5
  var loading = require("@dock365/loading");
  ```
## Example

#### [CodeSandbox Example Link](https://codesandbox.io/s/k9k0kojn83)
```javascript
  import React from "react";
  import ReactDOM from "react-dom";
  import loading from "@dock365/loading";


  function Comp(props) {
    return (
      <div className="App">
        <button
          onClick={() => {
            props.toggleLoading();
            setTimeout(() => {
              props.toggleLoading();
            }, 2000);
          }}
        >
          Do Action
        </button>
      </div>
    );
  }

  function LoadingMessage(props) {
    return <div className="App">Loading...</div>;
  }

  const App = loading(LoadingMessage, {})(Comp);
  const rootElement = document.getElementById("root");
  ReactDOM.render(<App />, rootElement);
```

## Properties
### Component Props
| Name               | Type   | Description                                                          |
| :----------------- | :----- | :----------------- | :------------------------------------------------------------------- |
| toggleLoading | (status?: boolean, relative?: boolean, label?: string, size?: any) => void | This is the function to invoke loading component, *status* is to optionally set status, loading or not. *relative* position of wrapping component. *label* loading message/label. *size* for adjusting loading spinner size.
|


### Loading component Props
| Name               | Type   | Description                                                          |
| :----------------- | :----- | :----------------- | :------------------------------------------------------------------- |
| label | string | Label to display on loading component |
| size | any | size to adjust spinner or any loading element |

### HOC Properties

```javascript
loading(LoadingComponent, { label, size, positionRelative })(Component)
```

| Name               | Type   | Description                                                          |
| :----------------- | :----- | :----------------- | :------------------------------------------------------------------- |
| label | string | default label|
|size | any | default size|
|positionRelative | boolean | default position value |


## Contributing!
All contributions are super welcome!


## License

React Confirm is MIT licensed.

---
_Source: https://npm.io/package/@dock365/loading · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
