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

168
Vistas
can't pass array of objects as prop a react component

I want to pass an array of objects as a prop of a component here's the array :

var champs = [
      { label: "coucou" },
      { label: "yo" }
]

and I pass it within my component like this :

<GererInformations champs={champs} />

below : the code of the GereInformations component :

class GererInformations extends React.Component {

    render() {
        console.log(this.props);
        Array.from(this.props.champs).map(champ => {
            var id = uuidv4();
            return (
                <div>
                    <label htmlFor={id}>{champ.label}</label>
                    <input id={id} type="text" />
                </div>
            )
        })
        return (
            this.props.champs
        );

    }
}

I have the error : Objects are not valid as a React child (found: object with keys {label}). If you meant to render a collection of children, use an array instead.

about 4 years ago · Juan Pablo Isaza
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