From 22a7de6aee47dbc220ea4048bbf0a0019eba1c5f Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 1 Apr 2014 11:42:15 -0700 Subject: [PATCH] [docs] Amend "References to components" tip to mention descriptors. --- tips/16-references-to-components.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tips/16-references-to-components.md b/tips/16-references-to-components.md index 38572276..a8ce67ee 100644 --- a/tips/16-references-to-components.md +++ b/tips/16-references-to-components.md @@ -14,18 +14,20 @@ If you're using React components in a larger non-React application or transition var myComponent = React.renderComponent(, 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 = ; +var 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).