getDefaultProps 返回的是this.props
getInitialState 返回的是 this.state
getDefaultProps和getInitialState在es6中被去掉了
React组件生命周期调用顺序
getDefaultProps
getInitialState
componentWillMount
render
componentDidMount
getDefaultProps:组件加载前被调用,被调用的时候,组件在构造this.props对象,return { }中的“{ }”为this.props
getInitialState: 用来创建组件原生的状态对象this.stae。 return { }中的“{ }”,这个空的对象为this.state
componentWillMount : 组件被挂载到DOM节点之前,会调用此函数,告诉我们此组件即将被加载,调用完后,组件会调用render函数。返回直接写return就ok 。
componentDidMount : 当这个函数被调用,程序就知道当前组件已经成功加载到浏览器中了(render函数已把component绘制到界面上)

getInitState: 放到construct里
getDefaultProps: 改写 static defaultProps=()
