I am using the AssyncStorage package from @react-native-community/async-storage and having a big problem when retrieving the stored data.
I don't know how to parse these Promisse results.
The fun fact is that if I console.log(value) inside the if statement, it shows the correct text, but it is returning the Promisse.
This is my function:
const getData = async (key: string) => {
try {
const value = await AsyncStorage.getItem(key)
if(value !== null) {
return value
}
} catch(e) {
TriggerAlert(I18n.t('error.readError') + e)
}
}
This is how I am calling the function
console.log(getData('@key'))
This is the output that I'm getting:
Promise {
"_40": 0,
"_55": null,
"_65": 0,
"_72": null,
}