alexa

How do you add a key to a variable map in react.js ? [duplicate]

How do you add a key to a variable map in react.js ? [duplicate]
 const props = [{
  count: 8
}, {
  count: 7
}, {
  count: 3
}]
const limit = props.map((x, index) => {
  return {
    count: Math.max(x.count, 0),
    key: `elementName${index}`
  }
})

console.log(limit)

208 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry