I just started learning to react native and firebase, so I want to get all collections from firestore, but the problem is when I want to return data they give me undefined even when I use async/await
async getAllAssistances() { let allAssistances; const assistances = await firebase.firestore().collection('assistances') assistances.get().then((querySnapshot :any) => { const tempDoc = querySnapshot.docs.map((doc:any) => { return { id: doc.id, ...doc.data() } }) console.log('===================================='); console.log(tempDoc); console.log('===================================='); allAssistances = tempDoc; }) console.log('********************************'); console.log(allAssistances); console.log('********************************'); return allAssistances; }// Output : ====================================Array [ Object {"city": "test","description": "test","id": "0N0iYx8RCPPSIEXfUQUk","latitude": 1,"longitude": 1,"nbPlaces": 1, },]====================================********************************undefined********************************