title: react-native fetch return status code + json
body: <p>I use fetch in react-native to make API calls.</p>
  
  <p>I need to get status code (200 , 401, 404 ) and the response data.</p>
  
  <p>This work to get the response data : </p>
  
  <pre><code>return fetch(url)
  .then(response =&gt; {
    return response.json();
  })
  .then(res =&gt; {
    console.log("reponse :", res); // &lt;-------- res is ok with data
   })    .catch(error =&gt; {
    console.error(error);
    return { name: "network error", description: "" };
  });
  </code></pre>
  
  <p>Now i tweak the first then to get the status code but data is not what i except</p>
  
  <pre><code>return fetch(url)
  .then(response =&gt; {
    const statusCode = response.status;
    const data = response.json();
    return { statusCode, data };
  })
  .then(res =&gt; {
    console.log("reponse :", res); // &lt;-------- i get a "promise"
   }).catch(error =&gt; {
    console.error(error);
    return { name: "network error", description: "" };
  });
  </code></pre>
  
  <p>the console log : </p>
  
  <pre><code>  {statusCode: 200, data: Promise}
  </code></pre>