Add documentation about JSX and displayName.

The section that described how JSX transform handles displayName was lost in commit 9b1ee4de46

Fixes #3338
This commit is contained in:
Rick Beerendonk
2015-03-07 19:01:58 +01:00
parent b95ad296da
commit 2184162e38
2 changed files with 10 additions and 1 deletions

View File

@@ -73,6 +73,15 @@ var app = React.createElement(
);
```
JSX will infer the class's [displayName](/react/docs/component-specs.html#displayName) from the variable assignment when the displayName is undefined:
```javascript
// Input (JSX):
var Nav = React.createClass({ });
// Output (JS):
var Nav = React.createClass({displayName: "Nav", });
```
Use the [JSX Compiler](/react/jsx-compiler.html) to try out JSX and see how it
desugars into native JavaScript, and the
[HTML to JSX converter](/react/html-jsx.html) to convert your existing HTML to

View File

@@ -95,7 +95,7 @@ Methods defined within this block are _static_, meaning that you can run them be
string displayName
```
The `displayName` string is used in debugging messages. JSX sets this value automatically; see [JSX in Depth](/react/docs/jsx-in-depth.html#react-composite-components).
The `displayName` string is used in debugging messages. JSX sets this value automatically; see [JSX in Depth](/react/docs/jsx-in-depth.html#the-transform).
## Lifecycle Methods