Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native AsyncStorage : blank page error

$
0
0

I'm trying to save my data locally with AsyncStorage but there seems to be an issue when I use getData

const storeData = async (value: string) => {  //storing data to local storage of the device  try {    await AsyncStorage.setItem("@storage_Key", value);  } catch (e) {}};const getData = async () => {  try {    const value = await AsyncStorage.getItem("@storage_Key");    if (value !== null) {      // value previously stored    }  } catch (e) {}};...<View><TextInput              editable              value={value}            />            {storeData(value)}            {getData()}</View>

I thought I would have my value back but I got a blank page. Any idea of how to use AsyncStorage ? I used https://react-native-async-storage.github.io/async-storage/docs/usage/ .


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>