title: How to fetch data over multiple pages?
body: <p>My project is based on React, redux, redux-saga, es6 and I try to fetch data from this API:</p>
  
  <p><a href="http://api.dhsprogram.com/rest/dhs/data/BD,2000,2004,2007?&amp;returnFields=CharacteristicLabel,Indicator,IndicatorId,Value&amp;f=json" rel="nofollow noreferrer">http://api.dhsprogram.com/rest/dhs/data/BD,2000,2004,2007?&amp;returnFields=CharacteristicLabel,Indicator,IndicatorId,Value&amp;f=json</a></p>
  
  <p>As you can see, this specific API call shows data with a limit of 100 data per page spread on 40 pages.</p>
  
  <p>According to this answer:
  <a href="http://userforum.dhsprogram.com/index.php?t=msg&amp;th=2086&amp;goto=9591&amp;S=Google" rel="nofollow noreferrer">http://userforum.dhsprogram.com/index.php?t=msg&amp;th=2086&amp;goto=9591&amp;S=Google</a>
  it says that you can extend the limit to a maximum of 3000data per page.</p>
  
  <p>However, in some cases I would do an API call that exceeds that limit which means I would not receive all my data doing it like this:</p>
  
  <pre><code>export function fetchMetaData(countryCode: string, surveyYears: string) {
  return (fetch('http://api.dhsprogram.com/rest/dhs/data/' + countryCode + ',' + surveyYears + '?returnFields=CharacteristicLabel,Indicator,IndicatorId,Value&amp;f=json')
      .then(response =&gt; response.json())
      .then(json =&gt; json.Data.map(survey =&gt; survey)))
  } 
  </code></pre>
  
  <p>So my question is; what is the best way to get all data from this API given that I know the total pages of data. The answer in the forum link suggest to loop through the API. However, I can't find the right syntax usage to do this. </p>
  
  <p>My idea would be doing one api call to get the total number of pages. Then store this in a state using redux+redux-saga. Then do a new request sending the total pages as parameter and fetch this total number of pages times. And by doing this I can't figure out the syntax to store the data for each iteration.</p>