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

134
Views
How to iterate on an array and print table in react

I want to iterate over an array and make a table row with its elements.
The coinlist is an array of object containing coin symbol and price. Is there any way to print table row with map function.

      <tbody>
            {coinlist.map((coin) => {
              return {
               
                 <tr>
                        <td>{coin.symbol}</td>
                        <td>{coin.price}</td>
                 </tr> 
            } })} 
        </tbody>
about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

    <table>
      <tr>
        <th>Symbol</th>
        <th>Price</th>
       
      </tr>
     {coinlist.map(coin)=>(
 <tr>
        <td>{coin.symbol}</td>
        <td>{coin.price}</td>
       
      </tr>
))}
     
    </table>
about 4 years ago · Santiago Gelvez Report

0

If you want to print out the object fields which make up the table row you can either console.log the entire object which makes up the row or each individual field. Something along the lines of:

<tbody>
    {coinlist.map((coin) => {
        console.log(coin); // see the entire coin object
        console.log(`symbol: ${coin.symbol} price: ${coin.price}`); // see individual fields of interest
        return {  
            <tr>
               <td>{coin.symbol}</td>
               <td>{coin.price}</td>
             </tr> 
         } 
     })} 
</tbody>

Hopefully that helps

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