Skip to content

react/prefer-es6-class Style

What it does

React offers you two ways to create traditional components: using the ES5 create-react-class module or the new ES6 class system.

Why is this bad?

This rule enforces a consistent React class style.

Example

jsx
var Hello = createReactClass({
  render: function () {
    return <div>Hello {this.props.name}</div>;
  },
});

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny react/prefer-es6-class
json
{
  "rules": {
    "react/prefer-es6-class": "error"
  }
}

References

Released under the MIT License.