title: GET API_Link net::ERR_FAILED -------- Uncaught (in promise) TypeError: Failed to fetch
body: <p>im trying to get an API from openweathermap.org but im still getting the error:</p>
  
  <blockquote>
    <ul>
    <li><strong>GET API_Link net::ERR_FAILED</strong></li>
    <li><strong>Uncaught (in promise) TypeError: Failed to fetch</strong></li>
    </ul>
  </blockquote>
  
  <p>here is my code:</p>
  
  <pre><code>import React, { useState } from 'react';
  import Form from './components/form'
  import Forecast from './components/forecast'
  
  
  
  
  const App = (props) =&gt; {
    const api_key = 'b6907d289e10d714a6e88b30761fae22';
    const [error, setError] = useState("")
    const [temperature, setTemperature] = useState("")
    const [humidity, setHumidity] = useState("")
    const [city, setCity] = useState("")
  
  
  const getWeather = async (e) =&gt; {
    console.log('jj')
    const city = e.target.elements.city.value;
    e.preventDefault();
    const api_call = await fetch(`https://samples.openweathermap.org/data/2.5/weather?q=${city}&amp;appid=${api_key}`);
    const response = await api_call.json();
    console.log('jj')
    if(city){
      setTemperature(response.main.temp)
      setHumidity(response.main.humidity)
      setCity(response.name)
    }else{
      setError('please fill out input error')
    }
  
  }
  return (
    &lt;div&gt;
  &lt;Form loadWeather={getWeather}/&gt;
  &lt;Forecast 
  temperature={temperature}
  humidity={humidity}
  city={city}
  error = {error}/&gt;
    &lt;/div&gt;
  )
  }
  </code></pre>
  
  <p>i did it with other apis there was no problem</p>