# react-istate

> A React hooks for istate

Latest version **0.0.22** (published 2020-07-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-istate
pnpm add react-istate
yarn add react-istate
bun add react-istate
```

## 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.0.22 |
| Published | 2020-07-02 |
| First published | 2020-06-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 29.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | linq2js |
| Keywords | scope, functional, context, state management, state manager, redux, state, react, hook |

## Links

- npm: https://www.npmjs.com/package/react-istate
- Homepage: https://github.com/linq2js/react-istate#readme
- Issues: https://github.com/linq2js/react-istate/issues
- npm.io page: https://npm.io/package/react-istate

## Dependencies (1)

- [istate](https://npm.io/package/istate.md) ^0.0.22

## 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.0.22 (latest) — 2020-07-02
- 0.0.20 — 2020-06-30
- 0.0.19 — 2020-06-30
- 0.0.18 — 2020-06-30
- 0.0.15 — 2020-06-29
- 0.0.14 — 2020-06-25
- 0.0.13 — 2020-06-25
- 0.0.10 — 2020-06-25
- 0.0.9 — 2020-06-25
- 0.0.8 — 2020-06-25
- 0.0.7 — 2020-06-24
- 0.0.6 — 2020-06-24
- 0.0.5 — 2020-06-24
- 0.0.4 — 2020-06-24
- 0.0.2 — 2020-06-22
- … 1 more at https://npm.io/package/react-istate/versions

## README

# react-istate

A React hooks for [istate](https://github.com/linq2js/istate)

## Using Suspense with async state

```jsx harmony
import {Suspense} from 'react';
import istate from 'istate';
import {useValue} from 'react-istate';
const ProfileState = istate(async () => {
  const profile = await LoadProfile();
  return profile;
});

const ProfileComponent = () => {
  const profile = useValue(ProfileState);
  return <div>{profile.name}</div>;
};

const ProfilePage = () => (
  <Suspense fallback={<Spinner />}>
    <ProfileComponent />
  </Suspense>
);
```

## Using loadable logic with async state

```jsx harmony
import {Suspense} from 'react';
import istate from 'istate';
import {Spinner} from 'ui-lib';
import {useLoadable} from 'react-istate';
const ProfileState = istate(async () => {
  const profile = await LoadProfile();
  return profile;
});

const ProfilePage = () => {
  const {state, value} = useLoadable(ProfileState);
  if (state === 'loading') {
    return <Spinner />;
  }
  return <div>{value.name}</div>;
};
```

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