title: Unable to update state with data from an external API
body: <p>im working on a project and i need to store fetched data from an API inside a state but it returns CORS, however, the data is succesfully fetched when i only console.log it :</p>
  <pre><code>function App() {
  
    const [search, setSearch] = useState('');
  
   useEffect(() =&gt; {
      const APIcall = async () =&gt; {
        if(search === '') return;
  
       
        const key = '5fce48978e1c410d4cc98624'
        const url = 'https://thisapi.io/data/api'
  
        const response = await fetch(`${url}/tag/${search}/post?&amp;limit=10`, { headers: { 'app-id': key, }  });
        const result = await response.json();
  
        console.log(result.data)
  
      }
  
      APIcall();
    }, [search])
  </code></pre>
  <p>but when i try to update my search state with this data i get &quot;from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.&quot; error, i tried using the alternative proxy CORS anywhere but still isn't working</p>
  <pre><code>function App() {
  
    const [search, setSearch] = useState('');
  
   useEffect(() =&gt; {
      const APIcall = async () =&gt; {
        if(search === '') return;
  
        const resultsPerPage = 30;
        const key = '5fce48978e1c410d4cc98624'
        const url = 'https://thisapi.io/data/api'
  
        const response = await fetch(`${url}/tag/${search}/post?&amp;limit=10`, { headers: { 'app-id': key, }  });
        const result = await response.json();
  
        setSearch(result.data)
  
      }
  
      APIcall();
    }, [search])
  </code></pre>