I keep running into the error No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
I'm aware that this is a frequently asked question on the web, but i see no helpfull answer here on stackoverflow other than a workaround using JSONP.
My code is
  componentDidMount() {
    if (navigator.geolocation){
      function success(position) {
        var latitude  = position.coords.latitude;
        var longitude = position.coords.longitude;
        axios.get(`https://api.darksky.net/forecast/apikey/`+latitude+`,`+longitude+`?units=auto`)
        .then(result => {
          this.setState({
            daily: result.data.daily.data,
            loading: false,
            error: null
          });
        })
          .catch(err => {
            // Something went wrong. Save the error in state and re-render.
            this.setState({
              loading: false,
              error: err
            });
          });
      };
      function error() {
        console.log( 'geolocation error' )
      };
      navigator.geolocation.getCurrentPosition(success.bind(this), error);
    }
  }
 
     
    