class App extends React.Component {
app: Application;
...
componentDidMound() {
axios.get(…).then(res => {
this.app.currentUser = res.data.data; // value assigned here.
console.log(this.app.currentUser); // and print the current user object.
};
console.log(this.app.currentUser); // but here print currentUser = undefined.
}
}
Why this.app.currentUser assigned in lambda but not outside?