React.createClass versus extends React.Component
Two ways to do the same thing. Almost. React traditionally provided the React.createClass method to create component classes, and released a small syntax sugar update to allow for better use with ES6 modules by extends React.Component , which extends the Component class instead of calling createClass . These differences are subtle in places, but have quite a few interesting differences worth exploring, which will allow you to make the best decision for which is best for you. Table of contents Syntax differences React.createClass React.Component propTypes and getDefaultProps React.createClass React.Component State differences React.createClass React.Component “this” differences React.createClass React.Component Mixins React.createClass React.Component Recommendations Syntax differences First, let’s explore the syntax differences by looking at two code examples and annotating them. React.createClass Here w...