Skip to content
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

docs remove rootNode for componentDidMount/Update #618

Merged
merged 1 commit into from
Nov 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions docs/docs/07-working-with-the-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ 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

* `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
Expand All @@ -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

Expand Down
14 changes: 11 additions & 3 deletions docs/docs/ref-03-component-specs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down