title: React Native unhandled promise rejection network error
body: <p>I'm having problems with this simple api call in react native and I have no idea why. I did exactly the same thing on reactJs and it worked on the browser perfectly.</p>
  <p>const FlatListGames = ({ navigation }) =&gt; {</p>
  <pre><code> const [games,setGames] = useState([]);
  
  
   useEffect(() =&gt; {
      function fetchAPI(){
        axios.get('http://127.0.0.1:5000')
          .then(response =&gt; {
              setGames(response.data)
          })
          .then(error =&gt; console.log(error));
      }
      fetchAPI();
   }, [])
  
   console.log(games);
  </code></pre>
  <p>[Unhandled promise rejection: Error: Network Error]</p>
  <ul>
  <li>node_modules/axios/lib/core/enhanceError.js:24:11 in error.toJSON</li>
  <li>node_modules/axios/lib/adapters/xhr.js:114:23 in dispatchXhrRequest</li>
  <li>node_modules/event-target-shim/dist/event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent</li>
  <li>node_modules/react-native/Libraries/Network/XMLHttpRequest.js:575:10 in setReadyState</li>
  <li>node_modules/react-native/Libraries/Network/XMLHttpRequest.js:389:6 in __didCompleteResponse</li>
  <li>node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js:189:10 in emit</li>
  <li>node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:425:19 in __callFunction</li>
  <li>node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:6 in __guard$argument_0</li>
  <li>node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:373:10 in __guard</li>
  <li>node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:4 in callFunctionReturnFlushedQueue</li>
  </ul>
  <ul>
  <li>[native code]:null in callFunctionReturnFlushedQueue</li>
  </ul>