title: React-native insert a value from render array to new array
body: <p>What I'm trying to do is insert a value from the old array that I have render to the new array.</p>
  
  <p>For now it can render the data that I want perfectly but when I push it into new array it become [id : undefined]</p>
  
  <p>How do call ticketId that I render from the ListView to save into myState array?</p>
  
  <pre><code> class SeactionSeating extends React.Component {
  
         state = { ticket: [], myState: [] };
  
         componentWillMount() {
           const tempticket = [];
            let i;
            let k = 1;
            let x;
            for (i = 1; i &lt;= 50; i++) {
                k++;
                if (i &lt; 10) {
                  x = 'north';
                } else if (i &lt; 20) {
                  x = 'south';
                } else if (i &lt; 30) {
                  x = 'west';
                } else if (i &lt; 40) {
                  x = 'east';
                }
               tempticket.push({ ticketId: i, row: k, gate: x });
            }
            this.setState({ ticket: tempticket });
            this.setState({ myState: [] });
            //i deliberately leave mystate empty so that i can push new array later
         }
       render() {
       const ticketTemp = () =&gt; {
         this.state.myState.push({ id: ticketId });
         console.log(this.state.myState);
       };
      return (
        &lt;Container&gt;
          &lt;View style={styles.listViewTitlePanel}&gt;
             &lt;Text&gt; hello there&lt;/Text&gt;
          &lt;/View&gt;
            &lt;Content&gt;
              &lt;ScrollView&gt;
              &lt;List&gt;
                { this.state.ticket.map((item, i) =&gt; (
                  &lt;ListItem
                  roundAvatar
                  key={i}
                  avatar={
                    &lt;View &gt;
                      &lt;Text&gt;{item.ticketId}&lt;/Text&gt;
                    &lt;/View&gt;
                  }
                    title={
                      &lt;View&gt;
                        &lt;Text&gt;ROW :{item.row}&lt;/Text&gt;
                      &lt;/View&gt;
                    }
                    subtitle={
                      &lt;View&gt;
                        &lt;Text&gt;GATE :{item.gate}&lt;/Text&gt;
                      &lt;/View&gt;
                    }
                     //call ticketTemp
                     onPress={ticketTemp}
                  /&gt;
                ))
                }
                &lt;/List&gt;
              &lt;/ScrollView&gt;
            &lt;/Content&gt;
        &lt;/Container&gt;
      );
    }
    }
  </code></pre>