prefer-stateless-function
Configuration
Rule Details
Stateless functional components are simpler than class based components and
will benefit from future React performance optimizations specific to these
components. This rule will check your class based components for missing
state, missing lifecycle methods, missing this member usages or other
patterns that suggest the component could be safely written as a stateless
function.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
ignorePureComponents
When true, classes that extend React.PureComponent are exempt — the
rationale being that PureComponent already provides a default
shouldComponentUpdate, which a plain functional component does not.
Defaults to false.
Examples of correct code for this rule with { "ignorePureComponents": true }: