如果使用的是es6的语法,也就是采用继承React.Component的方法来构建组件的话,就不能使用getInitialState()函数,会报警告 Warning: getInitialState was defined on TodoApp, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?