美文网首页
React 和 React-Native 中犯的错误

React 和 React-Native 中犯的错误

作者: 有情怀的程序猿 | 来源:发表于2017-04-05 11:25 被阅读0次

1: 在 render() 方法中调用了 this.setState() 方法设置 State, 会报错,

包括在 render() 方法中调用一个函数, 此函数中有设置 State 的操作

2: 一种写法: 判断是否存在, 存在就渲染文字

        { this.state.videoSource &&
          <Text style={{margin: 8, textAlign: 'center'}}>{this.state.videoSource}</Text>
        }

相关文章

网友评论

      本文标题:React 和 React-Native 中犯的错误

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