'How can I use Firestore data in react native?
I have firebase set up and I want to use the data that is retrieved from Firestore. My Firestore looks like this:
my function that gets Firestore data:
export const getQuestionsAndScheduelesFromFS = async () => {
const db = getFirestore();
const docRefQuestions = doc(db, "questions2022", "question01");
const docSnap = await getDoc(docRefQuestions);
if (docSnap.exists()) {
console.log("FS questions 2022", docSnap.data());
return docSnap.data();
} else {
console.log("No such data: QUESTIONS2022!");
return docSnap.data()
}
}
and this is how my data shows up in the console.log:

how can I use/ unwrap my question and alternative that I get from Firestore? alternatives is an array and question is a string.
What I want to do is to display the data inside a component.
this is my first time using Firestore with react native and I really do need help, thank you :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


