title: Calling Axios in React results in Network Error
body: <p>I'm trying to run the following command in a React component after clicking a button:</p>
  
  <pre><code>import axios from 'axios'    
  export function callApi(index, callback) {
  
  axios.get('http://localhost:8080/search?index=120&amp;json=true&amp;all=true')
      .then(res =&gt; {
          alert(res)
      })
      .catch((error) =&gt; {
          alert("error: " + error)
      })
  </code></pre>
  
  <p>}</p>
  
  <p>It works fine when I'm running the code in node, </p>
  
  <pre><code>var axios = require('axios')
  axios.get('http://localhost:8080/search?index=120&amp;json=true&amp;all=true')
      .then(res =&gt; {
          alert(res)
      })
      .catch((error) =&gt; {
          alert("error: " + error)
      })
  </code></pre>
  
  <p>But when I call it after clicking a button, I get an alert that says "Error: Network Error." I've tried running it with fetch() instead with no CORS either, but I'm getting an empty response instead of one with data.</p>
  
  <pre><code>fetch('http://192.168.1.156:8080/search?index=120&amp;json=true&amp;all=true', {mode: 'no-cors'})
      .then(res =&gt; {
          alert(res)
      })
      .catch((error) =&gt; {
          alert("error: " + error)
      })
  </code></pre>
  
  <p>I've tried running this with other APIs like <code>api.github.com</code> but I get the same result. It works in node, but not React.</p>