React beginner: I have made a basic weather app in React that works, but upon fetching new data, I get a CORS policy error. I did some researching online but none of those suggestions have fixed the issue. Can you please let me know how to modify my fetch request to fix this? CodePen included

This page summarizes the projects mentioned and recommended in the original post on /r/reactjs

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • node-fetch

    A light-weight module that brings the Fetch API to Node.js

  • Fortunately, there's another way. CORS is a browser-only implementation. Any non-browser HTTP request will not be subject to this restriction. If you're using something like Next.js or serving your React app from a server you control, like a Node.js server running Express, then you can consume this weather data from your server using something like the native HTTP node module or the node-fetch, and then send that response from your own backend. If it's all coming from the same server (or again, origin), then no further configuration required.

  • Next.js

    The React Framework

  • Fortunately, there's another way. CORS is a browser-only implementation. Any non-browser HTTP request will not be subject to this restriction. If you're using something like Next.js or serving your React app from a server you control, like a Node.js server running Express, then you can consume this weather data from your server using something like the native HTTP node module or the node-fetch, and then send that response from your own backend. If it's all coming from the same server (or again, origin), then no further configuration required.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • Express

    Fast, unopinionated, minimalist web framework for node.

  • Fortunately, there's another way. CORS is a browser-only implementation. Any non-browser HTTP request will not be subject to this restriction. If you're using something like Next.js or serving your React app from a server you control, like a Node.js server running Express, then you can consume this weather data from your server using something like the native HTTP node module or the node-fetch, and then send that response from your own backend. If it's all coming from the same server (or again, origin), then no further configuration required.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • How to Build a Hospital Record App with NextJs and Strapi

    4 projects | dev.to | 20 Apr 2022
  • How to Upgrade Your freeCodeCamp Project

    4 projects | dev.to | 31 Mar 2022
  • Deploy a Next.js SSR application

    3 projects | dev.to | 1 Mar 2022
  • Why I Decided to Leave Frontend Frameworks Behind

    2 projects | dev.to | 20 May 2024
  • How I Achieved Maintanability, and Scalability in My Projects

    4 projects | dev.to | 11 May 2024