React 和 React-Native 中犯的错误
2017-04-05 本文已影响0人
有情怀的程序猿
1: 在 render() 方法中调用了 this.setState() 方法设置 State, 会报错,
包括在
render()方法中调用一个函数, 此函数中有设置State的操作
2: 一种写法: 判断是否存在, 存在就渲染文字
{ this.state.videoSource &&
<Text style={{margin: 8, textAlign: 'center'}}>{this.state.videoSource}</Text>
}