Initialize State

suggest change

You should initialize state inside the constructor function of your component like this:

export default class MyComponent extends Component {
  constructor(props) {
    super(props);
    
    this.state = {
      myInteger: 0
    }
  }
  render() {
    return  (
      <View>
        <Text>Integer: {this.state.myInteger}</Text>
      </View>
    )
  }
}

Using setState one can update the view.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


State:
*Initialize State

Table Of Contents