In react all I want to do is lookup and return a number. I have:
getVAL = async () => {
const pathParam = this.props.match.params.myVal;
const url = "get-myVal?myVal=" + pathParam;
const response = await this._axios.get(url);
const intmyVal = Number(response.data);
return Number (intmyVal)
};
and I use this:
myVal=this.getVAL();
but when I render...
myVal={this.myVal}
I get Type 'Promise<number>' is not assignable to type 'number'.
Completely new to this weird world, so any pointers are appreciated.
EDIT: With jonrsharpe's help (any mistakes, mine) I now have:
myIdPromise=this.getID();
myIdPromise.then(don't know what to put here to just get a number {
...
})