I am calling the openweathermap api to retrieve the weather in higher-order component, which then renders the 'Main' component. However, after the success of ajax call, I get the following error:
TypeError: _getWeather2.default(...) is undefined
Code:
MainContainer.js:
import React from "react";
import getWeather from "../action/getWeather";
import Main from "./Main";
const MainContainer = () => {
// the error is somewhere related to this component
    var weather = getWeather( "london", "uk" )
        .then(( data ) => {
            console.log( "data in maincontainer is...", data );
            return <Main />;
        });
}
export default MainContainer;
getWeather.js:
const getWeather = ( city, country ) => {
    let queryPath = `http://api.openweathermap.org/data/2.5/forecast?q=${ city },${ country }&APPID=${ inserytKey }&mode=json`
    console.log( "queryPath is...", queryPath );
    fetch( queryPath )
        .then(( response ) => response.json( ))
        .then(( data ) => {
            console.log( "data is...", data );
            return data;
        })
        .catch(( err ) => {
            console.log( err );
        })
};
export default getWeather;
What am I doing wrong?
 
     
     
    