Basic Rules

Class vs React.createClass vs stateless

If you have internal state and/or refs, prefer class extends React.Component over React.createClass

Bad

const Listing = React.createClass({
  // ...
  render() {
    return <div>{this.state.hello}</div>;
  }
});

Good

class Listing extends React.Component {
  // ...
  render() {
    return <div>{this.state.hello}</div>;
  }
}

And if you don’t have state or refs, prefer normal functions (not arrow functions) over classes:

Bad

class Listing extends React.Component {
  render() {
    return <div>{this.props.hello}</div>;
  }
}
const Listing = ({ hello }) => (
  <div>{hello}</div>
);

Good

function Listing({ hello }) {
  return <div>{hello}</div>;
}

Mixins

Naming