1: 在 render()
方法中调用了 this.setState()
方法设置 State
, 会报错,
包括在
render()
方法中调用一个函数, 此函数中有设置State
的操作
2: 一种写法: 判断是否存在, 存在就渲染文字
{ this.state.videoSource &&
<Text style={{margin: 8, textAlign: 'center'}}>{this.state.videoSource}</Text>
}
网友评论