Declaring only one component per file improves readability and reusability of components.
The following patterns are considered warnings:
var Hello = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
var HelloJohn = React.createClass({
render: function() {
return <Hello name="John" />;
}
});
The following patterns are not warnings:
var Hello = require('./components/Hello');
var HelloJohn = React.createClass({
render: function() {
return <Hello name="John" />;
}
});
If you prefer to declare multiple components per files you can disable this rule.