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

216
Views
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 answers
Answer question

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 Report
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!