I have one functional component
import { DEFAULT_LANGUAGE} from './translations';import React, { useState } from 'react';export const Welcome= () => { const [appLanguage, setAppLanguage] = useState(DEFAULT_LANGUAGE); console.log(appLanguage);};
translations.js
import AsyncStorage from '@react-native-async-storage/async-storage'; export const DEFAULT_LANGUAGE= async () => { try { const response = await AsyncStorage.getItem('appLanguage'); if(response){ return response; } else{ return 'English'; } } catch (e) { return 'English'; } }
appLanguage returns promise object instead of value. How can I perform asynchronous operations inside as a constant variable?