edit: maybe I have simplified my example too much. Let me try again
file1.js
import conditonFunction from './conditonFunction'
console.log(conditonFunction())
file2.js
import asyncFunction from './asyncFunction'
export const conditonFunction = () => {
if (condition) {
return 'this doesnt matter'
} else {
asyncFunction().then(res => {
return res[0].whatever
})
}
}
if my condition is not met, I want the logged value of conditonFunction
to be the value of res
inside of asyncFunction
What am I missing?