I call a function inside react render with this code
{this.getChar({char})}
I have a function to return value from axios
getChar(url){
var res = ''
axios.get(url).then( datas => {
res = datas.name
console.log(datas.name)
});
return res
}
If i run the getchar function, in my console will display string as i want, but how to send that string to 'res' variable so i can return a string from the getChar function ?
In example, if i run
var url = 'https://some/url/'
and i call getchar function
getChar(url)
it will display
result
Thanks for help