# react-use-rxjs

> React hooks for rxjs.

Latest version **0.1.1** (published 2018-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-use-rxjs
pnpm add react-use-rxjs
yarn add react-use-rxjs
bun add react-use-rxjs
```

## 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.1.1 |
| Published | 2018-12-18 |
| First published | 2018-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Bo Bao |
| Maintainers | pinyin |
| Keywords | rxjs, react, react-hooks |

## Links

- npm: https://www.npmjs.com/package/react-use-rxjs
- Repository: https://github.com/pinyin/react-use-rxjs
- Homepage: https://github.com/pinyin/react-use-rxjs#readme
- Issues: https://github.com/pinyin/react-use-rxjs/issues
- npm.io page: https://npm.io/package/react-use-rxjs

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.3

## 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.1.1 (latest) — 2018-12-18
- 0.1.0 — 2018-12-16
- 0.0.2 — 2018-12-16
- 0.0.1 — 2018-12-16

## README

# react-use-rxjs

Hooks for rxjs

## Install

```
npm install --save react-use-rxjs
```

## Usage

```js
import { useRxjs } from 'react-use-rxjs'

const op = input => {
    return input.pipe(map(v => v.toString()))
}
const init = '2'

const RxComponent = () => {
    const [state, publish] = useRxjs(op, init, [])
    return <p onClick={() => publish(3)}>{state}</p>
}

<RxComponent/>

```

Will render 2 in the beginning, then 3 after clicked.

The first param of `useRxjs` can also be an `Observable`, in which case `state` would be values from the passed Observable and `publish` would be ignored.

The third param of `useRxjs` is optional and works just like the last param of official hooks like `useMemo` or `useEffect`.

## License

MIT

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