# lobx-react

> Lightweight React bindings for lobx based on React 16.8+ and Hooks

Latest version **0.2.0** (published 2022-01-09) · MIT license · 0 weekly downloads

## Install

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

## 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.2.0 |
| Published | 2022-01-09 |
| First published | 2020-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 408.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel K. |
| Maintainers | melnikov-s |
| Keywords | lobx, react-component, react, reactjs, reactive, hooks, observer, useObserver, useLocalStore, useAsObservableSource |

## Links

- npm: https://www.npmjs.com/package/lobx-react
- Repository: https://github.com/melnikov-s/lobx-react
- Homepage: https://github.com/melnikov-s/lobx-react#readme
- Issues: https://github.com/melnikov-s/lobx-react/issues
- npm.io page: https://npm.io/package/lobx-react

## 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.2.0 (latest) — 2022-01-09
- 0.1.0-rc9 — 2021-12-29
- 0.1.0-rc8 — 2021-02-17
- 0.1.0-rc7 — 2021-02-17
- 0.1.0-rc6 — 2020-12-18
- 0.1.0-rc5 — 2020-07-06
- 0.1.0-rc4 — 2020-06-22
- 0.1.0-rc3 — 2020-06-21
- 0.1.0-rc2 — 2020-06-20
- 0.1.0-rc1 — 2020-06-16

## README

# lobx-react

**You need React version 16.8.0 and above**

## API reference ⚒

### **`observer<P>(baseComponent: Component<P>, options?: ObserverOptions): Component<P>`**

```ts
interface ObserverOptions {
    // Pass true to wrap the inner component with React.forwardRef.
    // It's false by the default.
    forwardRef?: boolean
    graph?: Graph
}
```

The observer converts a component into a reactive component, which tracks which observables are used automatically and re-renders the component when one of these values changes.

### **`useObservable<T>(sourceOrInitializer: T | (() => T)): T`**

The useObservable hook can be used to turn any set of values into an observable object that has a stable reference (the same object is returned every time from the hook). You can either pass in a default value or a initializer function that will run once and the value returned will be the default.

### **`<Observer>{renderFn}</Observer>`**

Is a React component, which applies observer to an anonymous region in your component.

### **`enableStaticRendering(enable: true)`**

Call `enableStaticRendering(true)` when running in an SSR environment, in which `observer` wrapped components should never re-render, but cleanup after the first rendering automatically. Use `isUsingStaticRendering()` to inspect the current setting.

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