<?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>DEV Community: Derick Makuto Simiyu</title>
    <description>The latest articles on DEV Community by Derick Makuto Simiyu (@dmakuto).</description>
    <link>https://dev.to/dmakuto</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%2F221246%2F78123375-ada6-4b0c-91bd-5e3d26b26173.jpg</url>
      <title>DEV Community: Derick Makuto Simiyu</title>
      <link>https://dev.to/dmakuto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dmakuto"/>
    <language>en</language>
    <item>
      <title>How do I resolve react cors error!</title>
      <dc:creator>Derick Makuto Simiyu</dc:creator>
      <pubDate>Sun, 23 May 2021 08:41:19 +0000</pubDate>
      <link>https://dev.to/dmakuto/how-do-i-resolve-react-cors-error-14d3</link>
      <guid>https://dev.to/dmakuto/how-do-i-resolve-react-cors-error-14d3</guid>
      <description>&lt;p&gt;I'm really having difficulty to fix cors error on an app developed in react. The error snippet below from browser console:&lt;/p&gt;

&lt;p&gt;Access to fetch at '&lt;a href="https://thingproxy.freeboard.io/fetch/https://api.yelp.com/v3/businesses/search?term=fish&amp;amp;location=phoenix&amp;amp;sort_by=best_match"&gt;https://thingproxy.freeboard.io/fetch/https://api.yelp.com/v3/businesses/search?term=fish&amp;amp;location=phoenix&amp;amp;sort_by=best_match&lt;/a&gt;' from origin '&lt;a href="https://bitepoint.link"&gt;https://bitepoint.link&lt;/a&gt;' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.&lt;/p&gt;

&lt;p&gt;My fetch api code below:&lt;/p&gt;

&lt;p&gt;const apiKey = "xxx";&lt;/p&gt;

&lt;p&gt;const Yelp = {&lt;br&gt;
search(term, location, sortBy) {&lt;br&gt;
    return fetch( &lt;code&gt;https://thingproxy.freeboard.io/fetch/https://api.yelp.com/v3/businesses/searchterm=${term}&amp;amp;location=${location}&amp;amp;sort_by=${sortBy}&lt;/code&gt;,&lt;br&gt;
{&lt;br&gt;
// crossDomain: true,&lt;br&gt;
// mode: "cors",&lt;br&gt;
// method: "GET",&lt;br&gt;
// credentials: "include",&lt;br&gt;
// "Access-Control-Allow-Credentials": true,&lt;br&gt;
// "Access-Control-Allow-Methods": "GET",&lt;br&gt;
headers: {&lt;br&gt;
Authorization: &lt;code&gt;Bearer ${apiKey}&lt;/code&gt;,&lt;br&gt;
},&lt;br&gt;
}&lt;br&gt;
).then((response) =&amp;gt; {&lt;br&gt;
return response.json();&lt;br&gt;
}).then((jsonResponse) =&amp;gt; {&lt;br&gt;
if (jsonResponse.businesses) {&lt;br&gt;
return jsonResponse.businesses.map((business) =&amp;gt; {&lt;br&gt;
//console.log(business);&lt;br&gt;
return {&lt;br&gt;
id: business.id,&lt;br&gt;
imageSrc: business.image_url,&lt;br&gt;
name: business.name,&lt;br&gt;
address: business.location.address1,&lt;br&gt;
city: business.location.city,&lt;br&gt;
state: business.location.state,&lt;br&gt;
zipCode: business.location.zip_code,&lt;br&gt;
category: business.categories[0].title,&lt;br&gt;
rating: business.rating,&lt;br&gt;
reviewCount: business.review_count,&lt;br&gt;
};&lt;br&gt;
});&lt;br&gt;
}&lt;br&gt;
});&lt;br&gt;
},&lt;br&gt;
};&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Help to Fix Cors Error</title>
      <dc:creator>Derick Makuto Simiyu</dc:creator>
      <pubDate>Wed, 05 May 2021 18:04:34 +0000</pubDate>
      <link>https://dev.to/dmakuto/help-to-fix-cors-error-7jo</link>
      <guid>https://dev.to/dmakuto/help-to-fix-cors-error-7jo</guid>
      <description>&lt;p&gt;I'm really having difficulty to fix cors error on an app developed in react. Please help!&lt;br&gt;
Attached are the errors screenshots.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
