# react-rxjs-hook

> >

Latest version **1.0.6** (published 2019-04-04) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2019-04-04 |
| First published | 2019-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 113 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | jarlah |
| Maintainers | jarlah |

## Links

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

## Recent versions

- 1.0.6 (latest) — 2019-04-04
- 1.0.5 — 2019-04-03
- 1.0.4 — 2019-04-03
- 1.0.3 — 2019-04-03
- 1.0.2 — 2019-04-03
- 1.0.1 — 2019-04-03
- 1.0.0 — 2019-04-03

## README

# react-rxjs-hook

> 

[![NPM](https://img.shields.io/npm/v/react-rxjs-hook.svg)](https://www.npmjs.com/package/react-rxjs-hook) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-rxjs-hook react-rxjs rxjs
```

## Usage

```tsx
import React from 'react'

import { merge, Subject} from "rxjs";
import { map } from "rxjs/operators";
import { createStore } from 'react-rxjs';
import { useStore } from 'react-rxjs-hook'

const inc$ = new Subject();
const dec$ = new Subject();

const reducer$ = merge(
    inc$.pipe(map(() => (state) => state + 1)),
    dec$.pipe(map(() => (state) => state - 1))
);

const store$ = createStore("test", reducer$, 0);

const Counter = () => {
  const state = useStore(store$);
  return (
    <div>
      {state}
      <button onClick={() => inc$.next()}>+</button>
      <button onClick={() => dec$.next()}>-</button>
    </div>
  )
}
```

## License

MIT © [jarlah](https://github.com/jarlah)

---

This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).

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