title: Undefined is not a object in this.state - ReactNative
body: <p>I'm new in <code>ReactNative</code>, I'm getting the error <code>undefined is not a object</code> in my <code>this.state.rows</code> I am trying to dynamically add a <code>View</code> when a user clicks a <code>Button</code>. I tried using <a href="https://stackoverflow.com/questions/35524026/react-native-dynamically-add-element-to-dom-on-button-press"> this</a> and instead of using <code>getInitialState</code> I used <code>constructor(props)</code> but I keep on having the said error. Here is my code </p>
  
  <pre><code>constructor(props) {
  super(props);
  this.state = {
    rows: [],
  };
  }
  
  addRow(){
  this.state.rows.push(index++)
  this.setState({ rows: this.state.rows })
  }
  
  render(){
  
  let contactView = () =&gt; {
      return &lt;View&gt;
                &lt;AddComponent /&gt;
             &lt;/View&gt;
  }
  
  return(
   &lt;View&gt;
        &lt;View&gt;
          {contactView}
        &lt;/View&gt;
  
        &lt;TouchableHighlight onPress={ this.addRow } &gt;
          &lt;Text&gt;Add&lt;/Text&gt;
        &lt;/TouchableHighlight&gt;
    &lt;/View&gt;
  );
  </code></pre>
  
  <p>Thank you for your help! </p>