New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mobx-react-lite

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-react-lite - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

2

package.json
{
"name": "mobx-react-lite",
"version": "0.3.2",
"version": "0.3.3",
"description": "Lightweight React bindings for MobX based on experimental React hooks",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -21,3 +21,3 @@ # mobx-react-lite <!-- omit in toc -->

- [`useComputed(func: () => T, inputs: ReadonlyArray<any> = []): T`](#usecomputedfunc---t-inputs-readonlyarrayany---t)
- [`useObservableEffect<D extends IReactionDisposer>(disposerGenerator: () => D, inputs: ReadonlyArray<any> = []): D`](#useobservableeffectd-extends-ireactiondisposerdisposergenerator---d-inputs-readonlyarrayany---d)
- [`useDisposable<D extends IReactionDisposer>(disposerGenerator: () => D, inputs: ReadonlyArray<any> = []): D`](#usedisposabled-extends-ireactiondisposerdisposergenerator---d-inputs-readonlyarrayany---d)
- [Server Side Rendering with `useStaticRendering`](#server-side-rendering-with-usestaticrendering)

@@ -206,5 +206,5 @@ - [Why no Provider/inject?](#why-no-providerinject)

### `useObservableEffect<D extends IReactionDisposer>(disposerGenerator: () => D, inputs: ReadonlyArray<any> = []): D`
### `useDisposable<D extends IReactionDisposer>(disposerGenerator: () => D, inputs: ReadonlyArray<any> = []): D`
Adds an observable (Mobx) effect (`reaction`, `autorun`, `when`, or anything else that returns a disposer) that will be registered upon component creation and disposed upon unmounting.
The disposable is any kind of function that returns another function to be called on a component unmount to clean up used resources. Use MobX related functions like [`reaction`](https://mobx.js.org/refguide/reaction.html), [`autorun`](https://mobx.js.org/refguide/autorun.html), [`when`](https://mobx.js.org/refguide/when.html), [`observe`](https://mobx.js.org/refguide/observe.html), or anything else that returns a disposer.
Returns the generated disposer for early disposal.

@@ -215,3 +215,3 @@

```typescript
import { observer, useComputed, useObservableEffect } from "mobx-react-lite"
import { observer, useComputed, useDisposable } from "mobx-react-lite"

@@ -225,3 +225,3 @@ const Name = observer((props: { firstName: string; lastName: string }) => {

// when the name changes then send this info to the server
useObservableEffect(() =>
useDisposable(() =>
reaction(

@@ -228,0 +228,0 @@ () => fullName,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc