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

213
Views
How to count a map loop?

I want to make bolder the first loop of my table and the rest of them will be normal size. I want to count the map loop and check if it is 1, I will make style={{fontWeight:'bold'}} in <td> tag. How can I do that?

mycode

<table>
  ...
  {categories.map((val) => (
    <tr>
      <td>{val.name}</td>
      <td>{val.formula}</td>
      <td>{val.values[0].value.toLocaleString()}</td>
      <td>{val.values[1].value.toLocaleString()}</td>
      <td>{val.description}</td>
    </tr>
  ))}
</table>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try this in css.

tr:first-child {
      fontWeight:'bold';
    }
about 4 years ago · Juan Pablo Isaza Report

0

The second argument to map function is the index, you can use that to check the condition.

{categories.map( (val, index) => {
    if(index == 0)
       return ....
    else return ....
  }
)}

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!