title: apidata.map is not a function : ReactJS
body: <p>Can someone please tell me why i am getting this error . I tried fixing it all day, but I could not fix it. So at last i had to come at stackoverflow</p>
  <p>This is my code : App.js</p>
  <pre><code>import &quot;./App.css&quot;;
  
  function App() {
    const [inputvalue, setInputvalue] = useState(&quot; &quot;);
    const [apidata, setApidata] = useState([]);
    const [finalpoint, setFinalpoint] = useState(&quot;&quot;);
    useEffect(() =&gt; {
      fetch(
        `https://weatherapi-com.p.rapidapi.com/forecast.json?q=+${inputvalue}&amp;days=3`,
        {
          method: &quot;GET&quot;,
          headers: {
            &quot;x-rapidapi-host&quot;: &quot;weatherapi-com.p.rapidapi.com&quot;,
            &quot;x-rapidapi-key&quot;:
              &quot;7f89bf16ebmsh9dff0f23f963d34p190691jsn264543e18108&quot;,
          },
        }
      )
        .then((response) =&gt; {
          return response.json();
        })
        .then((data) =&gt; {
          setApidata(data);
        })
        .catch((err) =&gt; {
          console.error(err);
        });
    }, [finalpoint]);
  
    const onchangeinput = (e) =&gt; {
      setInputvalue(e.target.value);
    };
  
    const onsubmithandler = (e) =&gt; {
      e.preventDefault();
      setFinalpoint(inputvalue); 
    };
  
    return (
      &lt;div className=&quot;App&quot;&gt;
        &lt;div className=&quot;main&quot;&gt;
          &lt;h2&gt;Welcome To weather App &lt;/h2&gt;
        &lt;/div&gt;
  
        &lt;form onSubmit={onsubmithandler}&gt;
          &lt;input type=&quot;text&quot; value={inputvalue} onChange={onchangeinput} /&gt;
          &lt;button type=&quot;submit&quot;&gt;Search&lt;/button&gt;
        &lt;/form&gt;
        {apidata.map((data, i) =&gt; {
          return &lt;h1&gt;{data.current.feelslike_c}&lt;/h1&gt;;
        })}
      &lt;/div&gt;
      //Map
    );
  }
  
  export default App;
  </code></pre>
  <p>This is the error I am getting :
  <a href="https://i.stack.imgur.com/kPs6e.png" rel="nofollow noreferrer">enter image description here</a></p>