react小知识点

1、render函数什么时候会执行?
         当this.state/this.props发生改变的时候render函数就会执行

    2、组件第一次执行的时候会执行哪些生命周期
        constructor-->componentWillmount--->render --->componentDidMount

    3、哪些生命周期函数只会执行一次
        constructor
        componentWillMount
        componentDidMount
        componentWillUnmount

    4、哪些生命周期函数会执行多次
        render
        componentWillReceiveProps
        shouldComponentUpdate
        componentWillUpdate
        componentDidUpdate


    5、当this.state/this.props发生改变的时候会执行哪些生命周期函数
        this.state
            shouldComponentUpdate
            componentWillUpdate
            render
            componentDidUpdate


        this.props
            componentWillReceiveProps
            shouldComponentUpdate
            componentWillUpdate
            render
            componentDidUpdate

 

posted @ 2019-04-19 11:05  leslie-cheung  阅读(71)  评论(0编辑  收藏  举报