react生命周期函数

<div>
      <p> constructor()   //组件创建的瞬间执行</p>
     <p>componentWillMount()  //组件将要被挂载</p>
     <p> render()  //计算页面怎么渲染,数据一改变就会执行</p>
     <p>componentDidMount()   //组件挂载完成</p>
     <p> componentWwillUnmount() //组件将要被销毁</p>
     <p> shouldComponentUpdate()    //数据改变第一个执行的函数  ,返回布尔值,用来做性能优化。</p>
     <p>componentWillUpdate()  //即将更新页面时执行的函数</p>
     <p>componentDidUpdate()    //组件完成更新时执行</p>
     <p>componentWillReceiveProps() //父组件重新render的时候,子组件会执行这个函数</p>
   <p>shouldComponentUpdate(nextprops,nextstate) 用于做react的性能优化,避免和页面展示无关的数据变化,导致无谓的
    页面重新渲染。 vue内置了性能优化,所以没有shouldComponentUpdate函数。
   </p> <div>

  

 

posted @ 2017-11-21 10:01  螃蟹小姐  阅读(157)  评论(0)    收藏  举报