'how to display a firebase collection with react native?

How to display a collection with Firebase. I tried to display a return but it doesn't work so I tried to integrate my arrays in another array except that it rempis it by

Now I get my values in my foreach:

enter image description here

Now I don't get my values in my foreach:

enter image description here



Solution 1:[1]

Try something like this:

snapshot.then(snap => {
    const tableau = []
    snap.forEach(doc => {
     tableau.push({id: doc.id, ... doc.data()})
    })
    // set state here
    // setTableauData([...tableau])
})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cyrus Zei