'Error: Objects are not valid as a React child (found: object with keys {_U, _V, _W, _X}). in react-native

After passing a whole day on the problem, I can't fix it.

export default async function myFunction() {
    
let documentData = await [];

await firestore().collection('Col').get(). then(querySnapshot => {
  querySnapshot.docs.forEach(doc => {      
      documentData.push((doc.data()))
  })});
  
  return await (
    documentData.map((item,index)=> {
      return (
          <View key={index}>
            <Text >{item.name}</Text>
          </View>
      );
      }
  ))
}

Initially, I had few functions but I guessed that pass a data with parameters like {key:1, value:"yes"} was wrong so I do now all the treatment into a lonely function.

Howewer I still have the "Error: Objects are not valid as a React child (found: object with keys {_U, _V, _W, _X}). If you meant to render a collection of children, use an array instead." error.

Any quick help please ?

Thanks in advance,



Solution 1:[1]

Try this way

await firestore().collection('Col').get().then(querySnapshot => {
  querySnapshot.forEach(doc => {      
      documentData.push(doc.data())
})});

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 Nooruddin Lakhani