I know I can use AsyncStorage to save and restore data of my application. But the asynchrony seems to be a problem for me. In the web there's a localStorage which works synchronously and I'd like to know, is there an alternative of such storage.
For example, I would like to get some fields, like username, settings, etc. And only when I have all needed data, I can show the content.
I think I could show loading sreen until the data is restored. But is it a good solution? Should I do it with every screen, or it's better to do it once with all data?
I know this code is not valid, it just represents my idea
import AsyncStorage from '@react-native-async-storage/async-storage';
export class ViewModel {
async constructor() {
this.field1 = await AsyncStorage.getItem('field1');
this.field2 = await AsyncStorage.getItem('field2');
}
}