Skip to content

Instantly share code, notes, and snippets.

@agustinfece
Created Jun 18, 2021
Embed
What would you like to do?
App.js
import { StatusBar } from 'expo-status-bar';
import React, { useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
export default function App() {
const getTheme = async () => {
try {
const value = await AsyncStorage.getItem('theme');
console.log('value', value);
} catch(error) {
console.log('error', error);
};
};
useEffect(() => {
getTheme();
}, []);
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment