mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Merge pull request #3341 from rickbeerendonk/3338-documentation-issue
Add documentation about JSX and displayName.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user