Initial states using constructor vs getInitialState in React / React Native

In ES6 classes, you should use constructor, but in React.createClass you should use getInitialState method.


 class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = { /* initial state */ };
  }
}

var MyComponent = React.createClass({
  getInitialState() {
    return { /* initial state */ };
  },
});