# reactivooks

> Reactive hooks, using rxjs

Latest version **1.0.6** (published 2022-05-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-05-31 |
| First published | 2022-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Taylor Ben |
| Maintainers | taylor-ben |
| Keywords | rxjs, react, hooks, state, subject, behaviorsubject |

## Links

- npm: https://www.npmjs.com/package/reactivooks
- Repository: https://github.com/taylor-ben/reactivooks
- Homepage: https://github.com/taylor-ben/reactivooks#readme
- Issues: https://github.com/taylor-ben/reactivooks/issues
- npm.io page: https://npm.io/package/reactivooks

## Dependencies (1)

- [rxjs](https://npm.io/package/rxjs.md) ^7.5.5

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

- 1.0.6 (latest) — 2022-05-31
- 1.0.5 — 2022-05-31
- 1.0.4 — 2022-05-31
- 1.0.3 — 2022-05-31
- 1.0.2 — 2022-05-31

## README

## Install
```bash
npm i reactivooks
```


## Usage example

```tsx
import { click$, open$ } from "./store"
import { useBehaviorSubject, useSubject } from "reactivooks"

export default function App() {
  return (
    <div>
      <Hello/>
      <World/>
    </div>
  )
}

const Hello = () => {
  const fireClick = useSubject(click$)
  const [ open, setOpen ] = useBehaviorSubject(open$)
  return (
    <div>
      <Hello/>
      <World/>
    </div>
  )
}

const Hello = () => {
  const fireClick = useSubject(clicking)
  const handleClick = () => fireClick('Tell everyone I was clicked!')

  return (
    <div>
      <button onClick={handleClick}>Click me</button>
    </div>
  )
}

const World = () => {
  useSubject(click$, message => {
    console.log('message:', message)
  })
  const [ open ] = useBehaviorSubject(open$)
  return (
    <div>
      
    </div>
  )
}
```

`./store.ts`
```ts
import { BehaviorSubject, Subject } from "rxjs"

export const click$ = new Subject()

export const open$ = new BehaviorSubject(false)
```

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