How to send axios request to Firebase from local hosting, CORS interferes now?

  • 0
    Good day! I'm currently taking one of the React courses and ran into one problem. The problem is that due to CORS rules, I cannot access another domain from the local host.

    There are many methods on the net, but many I do not know how to use in my case. I am using the default application start which is applied in react: react-scripts start. So I don't know where to insert the code related to node.js.

    use this construction
    try { 
      const response = await'', this.state.quiz) 
    } catch(e) { 

    Error text:

    Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
    React Anonymous, Sep 8, 2019

  • 1 Answers
  • 0
    In this case, the error was that the request link does not contain .json. The URL should look like this: .json

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!