[docs] Amend "References to components" tip to mention descriptors.
This commit is contained in:
parent
c8fc3e38ab
commit
da27fb049a
|
@ -14,18 +14,20 @@ If you're using React components in a larger non-React application or transition
|
|||
var myComponent = React.renderComponent(<MyComponent />, myContainer);
|
||||
```
|
||||
|
||||
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:
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
```js
|
||||
/** @jsx React.DOM */
|
||||
|
||||
var myComponent = <MyComponent />;
|
||||
var myComponent = <MyComponent />; // This is just a descriptor.
|
||||
|
||||
// Some code here...
|
||||
// Some code here, possibly using static methods...
|
||||
|
||||
myComponent = React.renderComponent(myComponent, myContainer);
|
||||
```
|
||||
|
||||
> Note:
|
||||
>
|
||||
> 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.
|
||||
> 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).
|
||||
|
|
Loading…
Reference in New Issue