I’ve been using AsyncStorage to store JWT token however after a while and on some occasions, I get back the data as null.
I store the keys like below
await AsyncStorage.multiSet([
['JWT', token],
['tenancyID', tenancyID.toString()],
['email', email],
['password', password]
])
ad retrieve the token like below
const tenancyID = await AsyncStorage.getItem('tenancyID')
const email = await AsyncStorage.getItem('email')
const password = await AsyncStorage.getItem('password')
Although most of the time I get back the correct values, whenever I quit the application and restart, the data is coming back as null hence not persisting. What am I potentially doing wrong ? The examples have an ‘@’ in the beginning of the setItem, but I’m not sure if that is required for data persistence?