挂载时
- constructor
- render
- 更新dom和refs
- componentDidMount: 一般在这里调用ajax
更新时
- shouldComponentUpdate
- render
- 更新dom和refs
- componentDidUpdate
卸载时
- componentWillUnmount: 一般在这里解绑事件
父子组件生命周期顺序
挂载时
父: render
子: render
子: componentDidMount
父: componentDidMount
更新时
父: render
子: render
子: componentDidUpdate
父: componentDidUpdate
卸载时
父: componentWillUnmount
子: componentWillUnmount