I\'m using ES6 classes with Babel. I have a React component that looks like this:
import { Component } from \'react\';
export default class MyReactComponent ext
The developers talk about ES6 class support in the Release Notes for v0.13.0. If you use an ES6 class that extends React.Component
, then you should use a constructor()
instead of getInitialState
:
The API is mostly what you would expect, with the exception of getInitialState. We figured that the idiomatic way to specify class state is to just use a simple instance property. Likewise getDefaultProps and propTypes are really just properties on the constructor.