# react/no-multi-comp 📝 Disallow multiple component definition per file. Declaring only one component per file improves readability and reusability of components. ## Rule Details Examples of **incorrect** code for this rule: ```jsx var Hello = createReactClass({ render: function() { return
Hello {this.props.name}
; } }); var HelloJohn = createReactClass({ render: function() { return ; } }); ``` Examples of **correct** code for this rule: ```jsx var Hello = require('./components/Hello'); var HelloJohn = createReactClass({ render: function() { return ; } }); ``` ## Rule Options ```js ... "react/no-multi-comp": [, { "ignoreStateless": }] ... ``` ### `ignoreStateless` When `true` the rule will ignore stateless components and will allow you to have multiple stateless components, or one stateful component and some stateless components in the same file. Examples of **correct** code for this rule: ```jsx function Hello(props) { return
Hello {props.name}
; } function HelloAgain(props) { return
Hello again {props.name}
; } ``` ```jsx function Hello(props) { return
Hello {props.name}
; } class HelloJohn extends React.Component { render() { return ; } } module.exports = HelloJohn; ``` ## When Not To Use It If you prefer to declare multiple components per file you can disable this rule.