Browse Source

Merge pull request #618 from chenglou/didmout-didUpdate-new

docs remove rootNode for componentDidMount/Update
main
Paul O’Shannessy 11 years ago
parent
commit
d2d57643f7
  1. 10
      docs/07-working-with-the-browser.md
  2. 14
      docs/ref-03-component-specs.md

10
docs/07-working-with-the-browser.md

@ -80,7 +80,7 @@ React provides lifecycle methods that you can specify to hook into this process.
* `getInitialState(): object` is invoked before a component is mounted. Stateful components should implement this and return the initial state data.
* `componentWillMount()` is invoked immediately before mounting occurs.
* `componentDidMount(DOMElement rootNode)` is invoked immediately after mounting occurs. Initialization that requires DOM nodes should go here.
* `componentDidMount()` is invoked immediately after mounting occurs. Initialization that requires DOM nodes should go here.
### Updating
@ -88,7 +88,7 @@ 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.
* `componentDidUpdate(object prevProps, object prevState, DOMElement rootNode)` is invoked immediately after updating occurs.
* `componentDidUpdate(object prevProps, object prevState)` is invoked immediately after updating occurs.
### Unmounting
@ -103,12 +103,6 @@ _Mounted_ composite components also support the following methods:
* `getDOMNode(): DOMElement` can be invoked on any mounted component in order to obtain a reference to its rendered DOM node.
* `forceUpdate()` can be invoked on any mounted component when you know that some deeper aspect of the component's state has changed without using `this.setState()`.
> Note:
>
> The `DOMElement rootNode` argument of `componentDidMount()` and
> `componentDidUpdate()` is a convenience. The same node can be obtained by
> calling `this.getDOMNode()`.
## Browser Support and Polyfills

14
docs/ref-03-component-specs.md

@ -84,13 +84,17 @@ Invoked immediately before rendering occurs. If you call `setState` within this
### Mounting: componentDidMount
```javascript
componentDidMount(DOMElement rootNode)
componentDidMount()
```
Invoked immediately after rendering occurs. At this point in the lifecycle, the component has a DOM representation which you can access via the `rootNode` argument or by calling `this.getDOMNode()`.
Invoked immediately after rendering occurs. At this point in the lifecycle, the component has a DOM representation which you can access via `this.getDOMNode()`.
If you want to integrate with other JavaScript frameworks, set timers using `setTimeout` or `setInterval`, or send AJAX requests, perform those operations in this method.
> Note:
>
> Prior to v0.6, the DOM node was passed in as the last argument. If you were using this, you can still access the DOM node by calling `this.getDOMNode()`.
### Updating: componentWillReceiveProps
@ -157,13 +161,17 @@ Use this as an opportunity to perform preparation before an update occurs.
### Updating: componentDidUpdate
```javascript
componentDidUpdate(object prevProps, object prevState, DOMElement rootNode)
componentDidUpdate(object prevProps, object prevState)
```
Invoked immediately after updating occurs. This method is not called for the initial render.
Use this as an opportunity to operate on the DOM when the component has been updated.
> Note:
>
> Prior to v0.6, the DOM node was passed in as the last argument. If you were using this, you can still access the DOM node by calling `this.getDOMNode()`.
### Unmounting: componentWillUnmount

Loading…
Cancel
Save