Why should I use await before AsyncStorage.setItem()?

315 views Asked by At

In order to set value in AsyncStorage we use

await AsyncStorage.setItem();

but what is the difference if I use

AsyncStorage.setItem() ; //Not used await.

I've tried it and value will get set to AsyncStorage.

Is it guarantee that value will get set without await all the time ?

I know using await will wait till the promise get resolved from the setItem().

At the asyncStorage documentation also they have used await, If it works without await then why to use the await all the time.

0

There are 0 answers