Is it safe to use async/await with ionic v5?

Hi, I have recently switched to using async/await instead of using the promise chain.
I have researched but couldn’t get a clear answer.
Is it safe to use async/await with an ionic v5 (react) app?
Specifically, what mobile browser does ionic 5 use by default for ios and android?

yes it’s safe and in some case even necessary

Hello,

the typescript transpiler converts Typescript code to JavaScript which is backward compatible and will run in older browsers. In your tsconfig.json you’ll see a target property, which is typically set to es2015. Here you can see which browsers support ES2015 (ES6): ECMAScript 6 compatibility table

Regards,
Marius

Can you give an example of where you would consider async/await necessary?

Well maybe necessary is a bit “strong” as word :grinning:

I would use it in something like this

async printSomething(){
   let response = await fetch("someApiUrl")
   let json = await response.json();
}
this.printSomething();

OK, I was thinking there might be some React-specific need that would necessitate me staying even further away from the React subforum, as I’m allergic to async and await.

Ahaha I feel you :slight_smile:

I don’t use async that much as well