title: Cors error in react app when fetching data from external api
body: <p>Done alot of research on the topic of cross-origin-request-sharing and tried alot of fixes and nothing seems to have worked for me. currently I've been avoiding the error by passing my api request through a proxy server by appending 'https://cors-anywhere.herokuapp.com/' in front of my url but that seems like a less-than-ideal workaround more than an actual solution.</p>
  <p>the error i get is:</p>
  <blockquote>
  <p>Access to fetch at 'https://usgeocoder.com/api/get_info.php?address=498 Castro st&amp;zipcode=94114&amp;authkey=1674f5de56e81f040a01afcf07e6ab69&amp;format=json' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
  api.js:6 GET <a href="https://usgeocoder.com/api/get_info.php?address=498" rel="nofollow noreferrer">https://usgeocoder.com/api/get_info.php?address=498</a> Castro st%20st&amp;zipcode=94114&amp;authkey=1674f5de56e81f040a01afcf07e6ab69&amp;format=json net::ERR_FAILED</p>
  </blockquote>
  <p>I know I cant change the Access-Control-Allow-Origin header from client-side but I want to either make my own proxy (which I know i could do by cloning the 'cors-anywhere' git repo and hosting it on heroku myself but that still seems sketchy) or get through cors in a more adherent way. here is my whole api.js file that fetches the data for my main App.js react file:</p>
  <pre><code>
  
  export const getInfo = async (address, zip) =&gt; {
      const url = `https://usgeocoder.com/api/get_info.php?address=${address}&amp;zipcode=${zip}&amp;authkey=1674f5de56e81f040a01afcf07e6ab69&amp;format=json`;
      const response = await fetch(url);
      const json = await response.json();
      return json;
  }
  </code></pre>
  <p>Thank you in advance and please let me know if I can provide more info that would be helpful in answering my question.</p>
  <p>p.s I know there are other questions similar to this but I have been trying for hours and days to put together a fix for this and none of them seemed to work for me</p>