Posts

Showing posts with the label React JS

No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs,

Image
Just got a solution to an error which I was facing for the last 2 days, It was really a bit mistake which I was doing but now resolved,  I was trying to send a SMS from Twilio API  // const app = express();  const express = require('express');  app.use(cors()); <<<<< // if you just comment on this above line you get the same error mentioned below, I have set upped react server/website on 3000 port and express server on 4000 port. so the website sends a post request running on 3000 port to the server on port 4000 mechanisms called cross-origin request. // Access to fetch at 'http://localhost:4000/api/send-sms' from origin 'http://localhost:3000' 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 CO...

Build a weather web application in React JS | React JS beginner Tutorial

Image
  Let's learn more about how all this works by building a weather application using React JS. Installing Node and npm Building a weather web application in React JS, we will have run-time environment called Node. It is mostly used to execute JavaScript code. To download it, go to https://nodejs.org/en/ . You'll also need npm, which is a package manager built on Node. You can use it to install packages for your JavaScript apps. Fortunately it comes with Node, so you don't need to download it manually. Once both of them are finished, open your terminal or command prompt and type node -v. and check npm -v .This checks which version of Node you have. How to Create a React App For creating our react application, just open your project directory and open the terminal and type npx create-react-app <Your app name> in your terminal, or npx create-react-app weather-app for this project. You'll see that the packages are being installed. Once the packages are done, go into ...