Web Development

When React 0.13 was launched, you no longer needed to use React.createClass.

These are basically the same.

class YourComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = { /* initial state */ };
  }
}
var YourComponent = React.createClass({
  getInitialState() {
    return { /* initial state */ };
  },
});

getInitialState won’t work when you are using React.Component. Using it will show up as an error in your console:

Warning: getInitialState was defined on YourComponent, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?

Btw, The React community is moving closer to ES6. Also it is considered as the best practice.