Skip to content

Commit 4e82b10

Browse files
committed
Fix prefer-stateless-function (fixes #588)
1 parent 59dcd65 commit 4e82b10

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/rules/prefer-stateless-function.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This rule will check your class based React components for
88

99
* methods/properties other than `displayName`, `propTypes`, `render` and useless constructor (same detection as ESLint [no-useless-constructor rule](http://eslint.org/docs/rules/no-useless-constructor))
1010
* instance property other than `this.props` and `this.context`
11-
* `render` method that return anything but JSX (`undefined`, `null`, etc.)
1211
* presence of `ref` attribute in JSX
12+
* `render` method that return anything but JSX: `undefined`, `null`, etc. (only in React <15.0.0, see [shared settings](https://github.com/yannickcr/eslint-plugin-react/blob/master/README.md#configuration) for React version configuration)
1313

1414
If none of these 4 elements are found, the rule will warn you to write this component as a pure function.
1515

@@ -23,14 +23,16 @@ var Hello = React.createClass({
2323
});
2424
```
2525

26-
The following patterns are not considered warnings:
26+
The following pattern is not considered warnings:
2727

2828
```js
2929
const Foo = function(props) {
3030
return <div>{props.foo}</div>;
3131
};
3232
```
3333

34+
The following pattern is not considered warning in React <15.0.0:
35+
3436
```js
3537
class Foo extends React.Component {
3638
render() {

0 commit comments

Comments
 (0)