Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

218
Vistas
Error: Objects are not valid as a React child (found: object with keys {id, value}). If you meant to render a collection of children, use an array

The question is generic but I'm using firestore and it's a NoSQL and no answer was able to fix this error. So I have a useState:

    const [users, setUsers] = useState([]);

Then I am fetching the snapshot of documents in a collection and store it in an array:

    useEffect(() => {
        db.collection("Users").get().then((querySnapShot) => {
            let arr = []
            querySnapShot.docs.map((doc) => {
                arr.push({ id: doc.id, value: doc.data() })
            })
            setUsers(arr);
        });
    }, [db])

Then later in the code, I am using that array as:

            <p>Here is the list of all the users that are in the database: </p>
            {(users != null) && users.map((user, index) => (
                <ul key={index}>{user}</ul>
            ))}

I'm not sure what I am doing wrong but I'm getting

Error: Objects are not valid as a React child (found: object with keys {id, value}). If you meant to render a collection of children, use an array instead.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

a user is an object or array, not a string for example, and putting that makes an error. use {user.name} or property of user instead of whole object/array.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda