<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Rahul3229</title>
    <description>The latest articles on Forem by Rahul3229 (@driver3229).</description>
    <link>https://forem.com/driver3229</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1394222%2F1d801fac-3a9a-450c-ae64-a773319b24f7.jpg</url>
      <title>Forem: Rahul3229</title>
      <link>https://forem.com/driver3229</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/driver3229"/>
    <language>en</language>
    <item>
      <title>Cannot render components after the Fetch() call.</title>
      <dc:creator>Rahul3229</dc:creator>
      <pubDate>Thu, 25 Apr 2024 01:26:31 +0000</pubDate>
      <link>https://forem.com/driver3229/cannot-render-components-after-the-fetch-call-3l9a</link>
      <guid>https://forem.com/driver3229/cannot-render-components-after-the-fetch-call-3l9a</guid>
      <description>&lt;p&gt;Hi, I have a simple code which fetches data and converts it to JSON format. The converted JSON data is then stored in a useState variable. I have been trying to render a "Card" component using the useState variable with map() function. I don't get any errors, but I cannot find the "Card" component on the web page. Here's my code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const [actualData,setactualData]=useState(null);&lt;br&gt;
const myrequest=   fetch(fetch_url,{&lt;br&gt;
        method: 'GET',&lt;br&gt;
        // headers: {'Access-Control-Allow-Origin':'*','Content-Type':'application/json'}&lt;br&gt;
    }).then(response =&amp;gt; {&lt;br&gt;
        if (!response.ok) {&lt;br&gt;
          throw new Error('Network response was not ok');&lt;br&gt;
        }&lt;br&gt;
        //Actual_Data=response.json();&lt;br&gt;
        return response.json(); // Parse the JSON response&lt;br&gt;
      })&lt;br&gt;
      .then(data =&amp;gt; {&lt;br&gt;
        setactualData(data);&lt;br&gt;
        console.log(actualData);&lt;br&gt;
      })&lt;br&gt;
      .catch(error =&amp;gt; {&lt;br&gt;
        console.error('There was a problem with the fetch operation:', error);&lt;br&gt;
      });;&lt;br&gt;
    {&lt;br&gt;
         async ()=&amp;gt;{ await actualData.map((item,id)=&amp;gt;(&lt;br&gt;
             &amp;lt;Card name={item.First_Name}/&amp;gt;&lt;br&gt;
         ))}&lt;br&gt;
    }&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How does Fetch works exactly?, and how can I use GET method with parameters?</title>
      <dc:creator>Rahul3229</dc:creator>
      <pubDate>Thu, 18 Apr 2024 16:38:10 +0000</pubDate>
      <link>https://forem.com/driver3229/how-does-fetch-works-exactly-and-how-can-i-use-get-method-with-parameters-5b8e</link>
      <guid>https://forem.com/driver3229/how-does-fetch-works-exactly-and-how-can-i-use-get-method-with-parameters-5b8e</guid>
      <description>&lt;p&gt;Hi, I am new to React and I am trying to get specific search results based on a city name. I have a variable which is entirely dependent on user's input(city name) and I would like to use this variable as a parameter in my URL. I am sure my syntax is wrong and I tried googling, but I cannot understand anything. Can someone please explain how Fetch API works?, and how can I make a GET request with parameters?. Here's my code-&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const City1= useSelector(state=&amp;gt;state.City); // using Redux&lt;br&gt;
const myrequest= fetch('http://xxxx.xxxx.xxxx.xxxx/xxxx/:?{$City1}',{&lt;br&gt;
method: 'GET',&lt;br&gt;
headers: {'Access-Control-Allow-Origin':'*','Content-Type':'application/json'}&lt;br&gt;
}).then(response =&amp;gt; {&lt;br&gt;
if (!response.ok) {&lt;br&gt;
throw new Error('Network response was not ok');&lt;br&gt;
}&lt;br&gt;
return response.json();&lt;br&gt;
})&lt;br&gt;
.then(userData =&amp;gt; {&lt;br&gt;
// Process the retrieved user data&lt;br&gt;
console.log('User Data:', userData);&lt;br&gt;
})&lt;br&gt;
.catch(error =&amp;gt; {&lt;br&gt;
console.error('Error:', error);&lt;br&gt;
});;&lt;br&gt;
my error-&lt;br&gt;
Failed to load resource: the server responded with a status of 404 (Not Found)&lt;br&gt;
xxxx.js:66 Error: Error: Network response was not ok&lt;/code&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>css</category>
    </item>
  </channel>
</rss>
