React 生命周期
getInitialState 和 getDefaultProps 在 React 15中的createClass中提供着,但在react16被移除了,成一个独立的库(create-react-class)
初始化阶段
constructor: 构造函数,组件初始化
componentWillMount: 组件即将挂载
render: 渲染组件
componentDidMount: 组件已挂载
数据更新阶段
componentWillReceiveProps: 组件要接受父组件的参数
shouldComponentUpdate: 判断是否要更新组件
componentWillUpdate: 组件即将更新
render: 渲染组件
componentDidUpdate: 组件已更新