美文网首页
使用react-native 重构<一>base

使用react-native 重构<一>base

作者: 万能的pp | 来源:发表于2018-05-24 09:41 被阅读0次

    react-native的生命周期


    1.渲染前调用存在于客户端,服务器端

    componentWillMount(){}

    2.渲染之后调用只存在于客户端

    componentDidMount(){}

    3.生成相对应dom-frame之后调用

    componentWillReceiveProps(){}

    4.组件更新调用,返回一个boolean值

        shouldComponentUpdate():boolean{

    return boolean

    }

    5.组件即将更新调用,在render之前调用

    componentWillUpdate(){}

    6.组件完成更新

    componentDidUpdate(){}

    7.移除dom

    componentWillUnmount(){}


    state/props


    1.props(属性):父组件传递给子组件,单方向属性,可独享传递;

    2.state(状态):用于数据交互

    `

    `

    相关文章

      网友评论

          本文标题:使用react-native 重构<一>base

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