Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show how the displayName can be accessed #2324

Closed
wants to merge 1 commit into from
Closed

Show how the displayName can be accessed #2324

wants to merge 1 commit into from

Conversation

waldreiter
Copy link
Contributor

This has been ask many times, for example in #2285.

@@ -92,7 +92,7 @@ Methods defined within this block are _static_, meaning that you can run them be
### displayName

```javascript
string displayName
string constructor.displayName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the effort, but...

This section is discussing the spec, where displayName must be specified directly, not as a property of constructor. ie

React.createClass({
  displayName: 'MyComponent',
  ...
})

not

React.createClass({
  constructor: {
    displayName: 'MyComponent'
  },
  ...
})

The latter seems like an easy mistake to make given the way you have this presented. I would instead leave this as is and add a separate paragraph or note mentioning how it can be accessed for reading.

@waldreiter
Copy link
Contributor Author

@zpao You are totally right. I updated the commit and added an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants