its not the issue of your frontend, its the issue of backend If your backend written in backend, then install npm cors
npm i cors
const cors = require('cors');
app.use(cors())
If your server based on specific domain origin, then you need to configure cors with the domain
app.use(cors({
origin: 'localhost',
credentials: true
}));
For more you can visit CORS Github issue