From 4c7abcd4246ead4f5a1ebaf871d3b879fbde4163 Mon Sep 17 00:00:00 2001 From: xixixao Date: Sat, 4 Jan 2014 17:34:16 +0100 Subject: [PATCH] Document displayName --- docs/02.1-jsx-in-depth.md | 3 +++ docs/ref-03-component-specs.md | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/02.1-jsx-in-depth.md b/docs/02.1-jsx-in-depth.md index e4f3a29e..aff8beee 100644 --- a/docs/02.1-jsx-in-depth.md +++ b/docs/02.1-jsx-in-depth.md @@ -97,6 +97,9 @@ var MyComponent = React.createClass({/*...*/}); var app = ; ``` +JSX will infer the component's name from the variable assignment and specify +the class's [displayName](/react/docs/component-specs.html#displayName) accordingly. + See [Multiple Components](/react/docs/multiple-components.html) to learn more about using composite components. > Note: diff --git a/docs/ref-03-component-specs.md b/docs/ref-03-component-specs.md index 09cd5593..2b1b2339 100644 --- a/docs/ref-03-component-specs.md +++ b/docs/ref-03-component-specs.md @@ -67,6 +67,15 @@ The `mixins` array allows you to use mixins to share behavior among multiple com +### displayName + +```javascript +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). + + ## Lifecycle Methods Various methods are executed at specific points in a component's lifecycle.