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

103
Views
Select option display many boxes instead of a single dropdown with the options

So in my server I have a list of places that I would like to chose in dropdown. So before anything I'm splitting the places because they're stored as a single string:

  const where = settings?.places.split(',')

This is my first try to show it as dropdown options, the problem is that it displays one option with all the places:

        <select>
          <option value={where}> {where}</option>
        </select>

The other option shows every option in a different box:

        {where?.map((site, index) => {
          return(
            <select key={index}>
            <option value={site}>{site}</option>
            </select>
          )
        })}

enter image description here

Image of reference.

Any help is appreciated

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Assuming this is inside a function component, simply move the select tag outside of the map function.

return (
  ...
  <select>
    {where?.map((site, index) => {
      return(
        <option key={index} value={site}>{site}</option>
      )
    })}
  </select>
)
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!