React 和 React-Native 中犯的错误

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

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

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

        { this.state.videoSource &&
          {this.state.videoSource}
        }

你可能感兴趣的:(React 和 React-Native 中犯的错误)