To replicate the below, run this code on React Native
0.59.8
I have a function that looks like the below:
import AsyncStorage from 'react-native';
const saveToStorage = async (value) => {
await AsyncStorage.setItem('@store.key', value);
let value = await AsyncStorage.getItem('@store.key');
// Exception is thrown on ios because value is seen as null
}
But if I changed let to var the request is processed successfully.
const saveToStorage = async (value) => {
await AsyncStorage.setItem('@store.key', value);
var value = await AsyncStorage.getItem('@store.key');
// No exception is thrown on ios
}
Does anyone have an idea what is going on?