title: How to add new data in existing state in react native?
body: <p>I am trying to implement pagination. I am fetching array of 10 items in every <code>fetch request</code> and saving them in state when <code>onEndReached</code> of listview will called I am fetching next items and so on.</p>
  
  <p>My problem is when I am fetching next array of items, the items from previous fetch which are saved in state they are vanishing. and as I updating the state only currently fetched items are displaying.</p>
  
  <p>I want that items from previous fetch should not vanishes on next fetch. Can I append the new items to the existing state? If yes how can I do it?</p>
  
  <p>If I am going wrong then how can I achieve this using any component of react native which is I am unaware of?</p>
  
  <p>Here is my code</p>
  
  <pre><code>constructor(props) {
      super(props);
      this.state = {
          next: "",
          qwerty: []
      };
      this.fetchData = this.fetchData.bind(this);
  }
  
  fetchData() {
      return fetch('https://shopconapp.herokuapp.com/api/pagination/')
  
          .then((response) =&gt; response.json())
          .then((responseData) =&gt; {
              if (!responseData) {
                  navigate("Login");
              } else {
                  console.log(responseData);
  
                  let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) =&gt; r1 !== r2 });
                  this.setState({
                      nexturl: responseData.next,
                      qwerty: ds.cloneWithRows(responseData.results.post),
                  });
              }
          })
  }
  
  _onEndReached(){
  
      url = this.state.nexturl;
  
      return fetch(this.state.nexturl)
  
          .then((response) =&gt; response.json())
          .then((responseData) =&gt; {
              if (!responseData) {
                  navigate("Login");
              } else {
                  console.log(responseData);
  
                  let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) =&gt; r1 !== r2 });
                  this.setState({
                      nexturl: responseData.next,
                      qwerty: ds.cloneWithRows(responseData.results.post),
                  });
  
              }
          })
  }
  
  &lt;ListView
      dataSource={this.state.qwerty}
      onEndReachedThreshold={2}
      onEndReached={this._onEndReached.bind(this)}
  /&gt;
  </code></pre>