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

116
Views
Fill select with array of object

I have this result from my firebase in a variable :

[
    {
        "value": "CHProNd9BGYznrEr0u43",
        "label": "Jean"
    },
    {
        "value": "Huo0mofwJGKx2uEd9467",
        "label": "aaa"
    },
    {
        "value": "IO5w6WstNngCNyKRneYg",
        "label": "African"
    }
]

I get this result with this call to firebase :

export async function getCoupeurs() {

      let getCoupeurFromFirebase = [];
          const coupeursRef = collection(db, "coupeurs");
          getDocs(coupeursRef).then(snapshot => {
          snapshot.forEach(doc => {
              getCoupeurFromFirebase.push({
              value: doc.id,
              label: doc.data().nom,
              });
          });
        });
    
        return getCoupeurFromFirebase;
    }

and i want to fill this select input :

<select>
{ 
  coupeurs.map(coupeur => (
    <option key={coupeur.value} value={coupeur.value}>{coupeur.label}</option>
  ))
}
</select>

but i have nothing on my screen and no error, can you help me to do this by the best way ? [updated] The code on codepen.io , that work so i think the problem is the call for data from database there is a way to tell that i want to wait the result before send the data to my component ?

https://codepen.io/lbain/pen/ENpzBZ

<select>
          {
            coupeurs.map(coupeur => (
              <option>{coupeur.label}</option>
            ))
          }
</select>

thanks.

about 4 years ago · Santiago Gelvez
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!