美文网首页
React Native 面试

React Native 面试

作者: 快感的感知 | 来源:发表于2020-06-22 10:40 被阅读0次

    组件生命周期

    getDefaultProps

    getInitialState
    控件加载之前执行,返回值会被用于state的初始化值

    componentWillMount
    执行一次,在初始化render之前执行,如果在这个方法内调用setState,render()知道state发生变化,并且只执行一次

    render

    componentDidMount

    shouldComponentUpdate
    当shouldComponentUpdate方法返回false时,讲不会执行render()方法,componentWillUpdate和componentDidUpdate方法也不会被调用

    componentWillUpdate
    当props和state发生变化时执行,并且在render方法之前执行

    componentDidUpdate
    组件更新结束之后执行,在初始化render时不执行

    componentWillReceiveProps
    当props发生变化时执行

    componentWillUnmount
    当组件要被从界面上移除的时候

    相关文章

      网友评论

          本文标题:React Native 面试

          本文链接:https://www.haomeiwen.com/subject/extxfktx.html