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 use Object.entries with array index structure in ReactJs

I am having trouble maping through an array, i am using Object.entries to map the data, find below the example of the json structure. here is what i have tried but i get errors, i know the bath is not correct.

{
  Object.entries(this.props.optionData.steps).map((t, k) => (
    <option onClick={(e) => this.optionSelectHandle(t, k)} key={k} value={t[0]}>
      {t[1]}
    </option>
  ));
}


{
    "steps": [{
            "step_num": 1,
            "description": "Description"
        },
        {
            "step_num": 2,
            "description": "Description",
            "uncommon_field": "some data"
        }
    ]
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you could simply use the map function on steps like such:

{
  this.props.optionData.steps.map(step => (
    <option onClick={(e) => this.optionSelectHandle(e)} key={step.step_num} value={step.step_num}>
      {step.description}
    </option>
  ));
}

as it is already an 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!