Merge pull request #3341 from rickbeerendonk/3338-documentation-issue

Add documentation about JSX and displayName.
This commit is contained in:
Jim
2015-03-09 10:35:28 -07:00
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