# reasc

> React async component

Latest version **2.1.5** (published 2021-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install reasc
pnpm add reasc
yarn add reasc
bun add reasc
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.5 |
| Published | 2021-09-14 |
| First published | 2021-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 74.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | linq2js |
| Keywords | functional, react, redux, redux-react, flux, state, async, async-component, async-rendering, state-management, store, async, component |

## Links

- npm: https://www.npmjs.com/package/reasc
- npm.io page: https://npm.io/package/reasc

## Alternatives

- [@reckona/mreact-store](https://npm.io/package/@reckona/mreact-store.md) — 976 weekly downloads
- [regular-state](https://npm.io/package/regular-state.md) — 410 weekly downloads
- [@pacote/flux-actions](https://npm.io/package/@pacote/flux-actions.md) — 65 weekly downloads
- [@pilotlab/lux-debug](https://npm.io/package/@pilotlab/lux-debug.md) — 39 weekly downloads
- [vue-persist-state](https://npm.io/package/vue-persist-state.md) — 19 weekly downloads

## Recent versions

- 2.1.5 (latest) — 2021-09-14
- 2.1.4 — 2021-09-14
- 2.1.3 — 2021-09-14
- 2.1.2 — 2021-09-14
- 2.1.1 — 2021-09-14
- 2.1.0 — 2021-09-14
- 2.0.1 — 2021-09-13
- 2.0.0 — 2021-09-13
- 1.2.2 — 2021-09-13
- 1.2.1 — 2021-09-13
- 1.2.0 — 2021-09-13
- 1.1.5 — 2021-09-13
- 1.1.4 — 2021-09-13
- 1.1.3 — 2021-09-13
- 1.1.2 — 2021-09-12
- … 27 more at https://npm.io/package/reasc/versions

## README

# REASC

React Async Component

## Installation

**with NPM**

```bash
npm i reasc --save
```

with YARN

```bash
yarn add reasc
```

## Getting Started

```jsx
import { reasc } from "reasc";
import { useState } from "react";
const UserInfo = reasc(
  { loading: () => <div>Loading...</div> },
  async ({ user }, { delay }) => {
    if (!user) return <div>No data</div>;
    await delay(300);
    const apiUrl = `https://api.github.com/users/${user}`;
    const data = await fetch(apiUrl).then((res) => res.json());
    return <pre>{JSON.stringify(data, null, 2)}</pre>;
  }
);
const App = () => {
  const [user, setUser] = useState("");
  const handleChange = (e) => setUser(e.target.value);
  return (
    <>
      <input onChange={handleChange} placeholder="Enter github username" />
      <UserInfo user={user} />
    </>
  );
};
```

## Examples

- [Github User Search App](https://codesandbox.io/s/reasc-demo-gituser-search-70l6i?file=/src/App.tsx)

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