Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!