I am trying to access the [[PromiseValue]]
in my renderContent
function to render the values to the user. I see the data in my console log, but somehow I am unable to access it.
class PersonalInfo extends Component {
async fetchUser() {
const res = await axios.get('/api/current_user')
if(res)
return res.data
}
renderContent() {
if(this.fetchUser()) {
const userdata = this.fetchUser()
console.log(userdata)
console.log(userdata.email)
}
}
}
render() {
return <div>{this.renderContent()}</div>;
}