Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upJSX: "component definition is missing display name" #139
Comments
This comment has been minimized.
This comment has been minimized.
|
What warning do you get? Please run |
This comment has been minimized.
This comment has been minimized.
|
With the following code: /* global React */
export default class BPMComponent extends React.Component {
render () {
return (
<div></div>
)
}
} |
This comment has been minimized.
This comment has been minimized.
|
Do any other react users have an opinion on this? |
feross
added
the
question
label
May 17, 2015
This comment has been minimized.
This comment has been minimized.
|
@feross the |
This comment has been minimized.
This comment has been minimized.
|
I get the error for this if I don't include var React = require('react')
module.exports = React.createClass({
displayName: 'Alert',
propTypes: {
data: React.PropTypes.string
},
render: function () {
return (
<div>
{typeof this.props.data === 'string' ?
<button type="button" className="btn btn-warning btn-full">
{this.props.data}
</button>
: ''}
</div>
)
}
}) |
This comment has been minimized.
This comment has been minimized.
cayuu
commented
May 29, 2015
|
The example provided by @RichardLitt is the use-case where having a warning show up is useful if you haven't declared All other "normal" workflows (shown by the others in this thread) are valid/idiomatic, and do not warrant even a 'warning' (let alone an error). As @dcousens says, declaring For now, get back to the greenlight by adding export default class BPMComponent extends React.Component {
get displayName () { return 'BPMComponent'; }
// ...
}+1 to remove this as an error. |
This comment has been minimized.
This comment has been minimized.
|
If someone sends a PR for this, I'll merge it. |
saschagehlich commentedMay 17, 2015
I get this warning for code like this:
But the JSX in Depth article states:
So I guess this rule should be disabled?