I am facing an issue with passing the const clouds
variable from one file to another.
There seems to be something I am overlooking and I have been looking at this for too long - I really appreciate your help!
Source: getAVWXData.js
import axios from 'axios'
export function getAVWXData() {
axios.get(
https://some_url
)
.then((response) => {
const v = this
const res = response.data
const clouds = res['Cloud-List'][0.0][1];
console.log('Give me Clouds! ' + clouds) // <-- This works
})
}
Destination:
import { getAVWXData } from './get-avwx-data'
getAVWXData()
console.log('Give me Clouds! ' + getAVWXData.clouds) // < Returns undefined!