Document legacyness of the return value of ReactDOM.render()
Jim committed
Apr 1, 2016 at 16:58 UTC
ceb377254a1e7438ddb3fdafa7d6f3ddda0bd5b7
1 file changed
+5
-1
docs/docs/ref-01-top-level-api.md
+5
-1
@@ -139,7 +139,7 @@ The `react-dom` package provides DOM-specific methods that can be used at the to
139
### ReactDOM.render
140
141
```javascript
142
-ReactComponent render(
142
+render(
143
ReactElement element,
144
DOMElement container,
145
[function callback]
@@ -161,6 +161,10 @@ If the optional callback is provided, it will be executed after the component is
161
> `ReactDOM.render()` does not modify the container node (only modifies the children of the container). In
162
> the future, it may be possible to insert a component to an existing DOM node without overwriting
163
> the existing children.
164
+>
165
+> `ReactDOM.render()` currently returns a reference to the root `ReactComponent` instance. However, using this return value is legacy
166
+> and should be avoided because future versions of React may render components asynchronously in some cases. If you need a reference to the root `ReactComponent` instance, the preferred solution is to attach a
167
+> [callback ref](/react/docs/more-about-refs.html#the-ref-callback-attribute) to the root element.
168
169
170
### ReactDOM.unmountComponentAtNode