Skip to content

Include rootNode as arg to componentWillUnmount #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/docs/07-working-with-the-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ React provides lifecycle methods that you can specify to hook into this process.

* `componentWillReceiveProps(object nextProps)` is invoked when a mounted component receives new props. This method should be used to compare `this.props` and `nextProps` to perform state transitions using `this.setState()`.
* `shouldComponentUpdate(object nextProps, object nextState): boolean` is invoked when a component decides whether any changes warrant an update to the DOM. Implement this as an optimization to compare `this.props` with `nextProps` and `this.state` with `nextState` and return false if React should skip updating.
* `componentWillUpdate(object nextProps, object nextState)` is invoked immediately before updating occurs. You cannot call `this.setState()` here.
* `componentWillUpdate(object nextProps, object nextState, DOMElement rootNode)` is invoked immediately before updating occurs. You cannot call `this.setState()` here.
* `componentDidUpdate(object prevProps, object prevState, DOMElement rootNode)` is invoked immediately after updating occurs.


### Unmounting

* `componentWillUnmount()` is invoked immediately before a component is unmounted and destroyed. Cleanup should go here.
* `componentWillUnmount(DOMElement rootNode)` is invoked immediately before a component is unmounted and destroyed. Cleanup should go here.


### Mounted Methods
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/09-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ Normally you should try to avoid all uses of `forceUpdate()` and only read from
```javascript
object getInitialState()
componentWillMount()
componentDidMount(DOMElement domNode)
componentDidMount(DOMElement rootNode)
componentWillReceiveProps(object nextProps)
boolean shouldComponentUpdate(object nextProps, object nextState)
componentWillUpdate(object nextProps, object nextState)
componentWillUpdate(object nextProps, object nextState, DOMElement rootNode)
ReactComponent render()
componentDidUpdate(object prevProps, object prevState, DOMElement domNode)
componentWillUnmount()
componentDidUpdate(object prevProps, object prevState, DOMElement rootNode)
componentWillUnmount(DOMElement rootNode)
```

See the [working with the browser](./working-with-the-browser.html) documentation for more details on these lifecycle methods.
Expand Down
4 changes: 2 additions & 2 deletions src/core/ReactCompositeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ var ReactCompositeComponentMixin = {
unmountComponent: function() {
this._compositeLifeCycleState = CompositeLifeCycle.UNMOUNTING;
if (this.componentWillUnmount) {
this.componentWillUnmount();
this.componentWillUnmount(this.getDOMNode());
}
this._compositeLifeCycleState = null;

Expand Down Expand Up @@ -686,7 +686,7 @@ var ReactCompositeComponentMixin = {
var prevState = this.state;

if (this.componentWillUpdate) {
this.componentWillUpdate(nextProps, nextState, transaction);
this.componentWillUpdate(nextProps, nextState, this.getDOMNode());
}

this.props = nextProps;
Expand Down