'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin'

You can't access resources when the origin you are accessing to is not the same as the origin you are using.

Fixes

As commented by @Freestyle09, you need to enable CORS policies in your backend:

In PHP:

header('Access-Control-Allow-Origin: *');

In node.js (Express):

  • Install cors package from npm.
var express = require('express');
var cors = require('cors');
var app = express();

app.use(cors());

This should set the headers to Access-Control-Allow-Origin: *, if you want to specify a host:

app.use(cors({
  origin: 'http://yourapp.com'
}))

Read more from this answer:

  • https://stackoverflow.com/a/7564919/11555297
  • https://medium.com/zero-equals-false/using-cors-in-express-cac7e29b005b

Thank you all for your input and answers, this problem has been resolved, and it's running.

this problem is simple, I just add it in pckage.json

  "proxy":"http://127.0.0.1:8000",

and i am use in axios fatch

axios({
        url:'/api/login',
        data:data,
        method:"POST",
        mode: 'no-cors',
        headers:{
            "Content-Type": "application/json",
            "Access-Control-Allow-Origin": process.env.REACT_APP_API_URL,
            "Access-Control-Request-Headers": 'Content-Type, Authorization'

        }
    })
    .then(res => {
        console.log(res);
    })
    .catch(err =>{
        console.log(err);
    })

and it's work for me thank you all (n_n)