Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mobx-react

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-react - npm Package Compare versions

Comparing version 3.0.4 to 3.0.5

2

index.js

@@ -51,2 +51,4 @@ (function() {

isRenderingPending = true;
if (typeof self.componentWillReact === "function")
self.componentWillReact();
React.Component.prototype.forceUpdate.call(self)

@@ -53,0 +55,0 @@ }

@@ -51,2 +51,4 @@ (function() {

isRenderingPending = true;
if (typeof self.componentWillReact === "function")
self.componentWillReact();
React.Component.prototype.forceUpdate.call(self)

@@ -53,0 +55,0 @@ }

2

package.json
{
"name": "mobx-react",
"version": "3.0.4",
"version": "3.0.5",
"description": "React bindings for mobx. Create fully reactive components.",

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

@@ -30,3 +30,3 @@ # mobx-react

* TodoMVC MobX, React, ES6, JSX, Hot reloading: [MobX-React-TodoMVC](https://github.com/mobxjs/mobx-react-todomvc)
* Minimal MobX, React, Typescript, TSX: [MobX-React-Typescript](https://github.com/mobxjs/mobx-react-typescript)
* Minimal MobX, React, Typescript, TSX: [MobX-React-Typescript-Boilerplate](https://github.com/mobxjs/mobx-react-typescript-boilerplate)
* Minimal MobX, React, ES6(babel), JSPM with hot reloading modules:

@@ -69,2 +69,26 @@ [jspm-react](https://github.com/capaj/jspm-react)

### `componentWillReact` (lifecycle hook)
React components usually render on a fresh stack, so that makes it often hard to figure out what _caused_ a component to re-render.
When using `mobx-react` you can define a new life cycle hook, `componentWillReact` (pun intended) that will be triggered when a component will be scheduled to re-render because
data it observes has changed. This makes it easy to trace renders back to the action that caused the rendering.
```javascript
import {observer} from "mobx-react";
@observer class TodoView extends React.Component {
componentWillReact() {
console.log("I will re-render, since the todo has changed!");
}
render() {
return <div>this.props.todo.title</div>
}
}
```
* `componentWillReact` doesn't take arguments
* `componentWillReact` won't fire before the initial render (use `componentWillMount` instead)
* `componentWillReact` won't fire when receiving new props or after `setState` calls (use `componentWillUpdate` instead)
## FAQ

@@ -128,2 +152,6 @@

### 3.0.5
Introduced `componentWillReact`
### 3.0.4

@@ -130,0 +158,0 @@

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