I'm trying to fetch from randomuser.me, my component is:
import React, { Component } from 'react';
class RandomUser extends Component {
    state = {
        contacts:[]
    }
    async   componentDidMount(){
        const url = 'http://api.randomuser.me?results=20';
        const response = await fetch(url, {mode: 'cors'});
        const data = await response.json();
        console.log(data);
    }
    render(){
    console.log(this.state.contacts);
        return (
            <div>
                <h2>Users:</h2>
            </div>
            )
    }
}
export default RandomUser;
The error I see in console is:
Access to fetch at 'http://api.randomuser.me/?results=20' from origin 'http://localhost:3000' has been blocked by CORS policy: 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 CORS disabled.
How do I correct it? I'm not using any local server and relying on randomuser.me
Please help.

 
     
    