react优化
在react组件挂载过程中,会依次执行下面的函数
- constructor()
- componentWillMount()
- render()
- componentDidMount() 由于父组件发生变化,子组件重新渲染是会执行下面的函数
- componentWillReceiveProps()
- shouldComponentUpdate()
- componentWillUpdate()
- render()
- componentDidUpdate() 组件自身状态发生变化,调用setState时,执行下面函数
- shouldComponentUpdate()
- componentWillUpdate()
- render()
- componentDidUpdate() 调用forceUpdate会发生强制更新,执行下面函数
- componentWillUpdate()
- render()
- componentDidUpdate() showComponentUpdate可以用来提升性能
##Python
- 使用with语句操作文件IO是个好习惯。