[docs] Amend "References to components" tip to mention descriptors.
Kunal Mehta committed
Apr 1, 2014 at 11:42 UTC
da27fb049ac5f1c7a7ff22aaa3efac46a37a6dcb
1 file changed
+6
-4
docs/tips/16-references-to-components.md
+6
-4
@@ -14,18 +14,20 @@ If you're using React components in a larger non-React application or transition
14
var myComponent = React.renderComponent(<MyComponent />, myContainer);
15
```
16
17
-If you pass a variable to 'React.renderComponent`, it's not guaranteed that the component passed in will be the one that's mounted. In cases where you construct a component before mounting it, be sure to reassign your variable:
17
+Keep in mind, however, that the "constructor" of a component doesn't return a component instance! It's just a **descriptor**: a lightweight representation that tells React what the mounted component should look like.
18
+
19
+Descriptors also contain any methods that you define in the [statics](http://facebook.github.io/react/docs/component-specs.html#statics) property of the component.
20
21
```js
22
/** @jsx React.DOM */
23
22
-var myComponent = <MyComponent />;
24
+var myComponent = <MyComponent />; // This is just a descriptor.
25
24
-// Some code here...
26
+// Some code here, possibly using static methods...
27
28
myComponent = React.renderComponent(myComponent, myContainer);
29
```
30
31
> Note:
32
>
31
-> This should only ever be used at the top level. Inside components, let your `props` and `state` handle communication with child components, and only reference components via `ref`s.
33
+> This should only ever be used at the top level. Inside components, let your `props` and `state` handle communication with child components, and only reference components via [refs](http://facebook.github.io/react/docs/more-about-refs.html).