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

94
Views
Using Map to Display Two Arrays Overlapping Each Other

Consider two arrays:

props = ['prop1','prop2','prop3']

about = ['about1','about2','about3']

I'm looking to display them in a way where the index of each array is paired to the other, sort of like:

props[0] - 'prop1'
about[0] - 'about1'

props[1] - 'prop2'
about[1] - 'about2'

So far i've tried nesting two maps together but i'm getting an output of many repetitive or invalid values. Does anyone know how I can tweak the solution I have to properly display the arrays with map?

 props.map( arg => {
   return (
    about.map ( arg2 => {
      <div>
      <p> {arg} </p>
      <p> {arg2} </p>
      </div>
    })
   );
  })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

What you need to do is use the index property on the map method to access the element in the second array at the same index as the first.

Your code would look like this

 props.map((arg, i) => {
   return (
     <div>
       <p>{arg}</p>
       <p>{about[i]}</p>
     </div>
   );
 });

However, you should note that for this to work, both arrays have to be of the same length, or the one you're mapping should be of greater length than the second. Else you would get undefined for some values.

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!