# react-promise-client

> React hook to handle promises

Latest version **2.1.0** (published 2023-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-promise-client
pnpm add react-promise-client
yarn add react-promise-client
bun add react-promise-client
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2023-09-17 |
| First published | 2023-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lalo3k |
| Maintainers | lalo3k |
| Keywords | react, promise, react-promise-client, lightweight |

## Links

- npm: https://www.npmjs.com/package/react-promise-client
- Repository: https://github.com/lalo3k/react-promise-client
- Homepage: https://github.com/lalo3k/react-promise-client#readme
- Issues: https://github.com/lalo3k/react-promise-client/issues
- npm.io page: https://npm.io/package/react-promise-client

## 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

- 2.1.0 (latest) — 2023-09-17
- 2.0.0 — 2023-07-06
- 1.1.1-2 — 2023-04-28
- 1.1.0 — 2023-03-25
- 1.0.0 — 2023-03-25
- 0.0.1-19 — 2023-03-25
- 0.0.1-18 — 2023-03-25
- 0.0.1-15 — 2023-03-25
- 0.0.1-14 — 2023-03-25
- 0.0.1-13 — 2023-03-25
- 0.0.1-12 — 2023-03-25
- 0.0.1-11 — 2023-03-25

## README

# React promise client

This is a lightweight promise handler.

## using npm
```bash
npm i react-promise-client
```

In React:

```js
    const { data, isLoading, execute } = usePromise({
            promiseFn: ()=> asyncAwaitFunction(),
            onSuccess results => console.log(results),
            onFailure: error => console.log(error);
    }, [...deps])

    return isLoading? <div>Loading...</div> : <div>done...</div>
```

 - execute: execute promise manually and wait for results in `data`.
 - data: results from promise call.
 - isLoading: true when busy, else false.
 - deps: dependencies like any other hook, this is optional

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