Difference between using constructor vs getInitialState in React / React Native?

The difference between constructor and getInitialState is the difference between ES6and ES5 itself.
getInitialState is used with React.createClass and
constructor is used with React.Component.

Hence the question boils down to advantages/disadvantages of using ES6 or ES5.

Let’s look at the difference in code


var TodoApp = React.createClass({ 
propTypes: {
title: PropTypes.string.isRequired
getInitialState () {
return {
items: []


class TodoApp extends React.Component {
constructor () {
this.state = {
items: []

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

There are some differences between React.createClass and React.Component. For instance, how this is handled in these cases.

constructor can also be used to handle such situations. To bind methods to a component instance, it can be pre-bonded in the constructor.