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

209
Views
Trying to display key/value pairs in react component using map?

i have data returned from the backend which i wanted display in react component with below approach it is only printing the values , how do i print both keys and values in the DOM.

index.js

 {Object.entries(data).map(([key, value]) => (
                 <Card>
                 <CardContent>
                   <Typography variant="body2" color="text.secondary">
                   <p>{data[key]}</p>
                   <p>{data[value]}</p>
                   </Typography>
                 </CardContent>
               </Card>
              ))} 

data sample

{ 'User': ': Admin',
'Location': ': New York, NY',
'Company Name': ': Millenium'
}
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Just use key instead of data[key] and value instead of data[value]. Also, be sure to provide a unique key on each mapped item in your list.

{Object.entries(data).map(([key, value]) => (
  <Card key={key}>
    <CardContent>
      <Typography variant="body2" color="text.secondary">
        <p>{key}</p>
        <p>{value}</p>
      </Typography>
    </CardContent>
  </Card>
))}
about 4 years ago · Santiago Trujillo 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!