-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for require-render-return
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Enforce ES5 or ES6 class for returning value in render function (require-render-return) | ||
|
||
When writing the `render` method in a component it could be easy to forgot to return the JSX content. This rule will warn you if the `return` statement is missing. | ||
|
||
## Rule Details | ||
|
||
The following patterns are considered warnings: | ||
|
||
```js | ||
var Hello = React.createClass({ | ||
render() { | ||
<div>Hello</div>; | ||
} | ||
}); | ||
|
||
class Hello extends React.Component { | ||
render() { | ||
<div>Hello</div>; | ||
} | ||
} | ||
``` | ||
|
||
The following patterns are not considered warnings: | ||
|
||
```js | ||
var Hello = React.createClass({ | ||
render() { | ||
return <div>Hello</div>; | ||
} | ||
}); | ||
|
||
class Hello extends React.Component { | ||
render() { | ||
return <div>Hello</div>; | ||
} | ||
} | ||
``` |