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

272
Views
Cada niño en una lista debe tener un accesorio de "clave" único. pero no estoy llamando a ningún componente

si llamo a todos los precios de descuento usando el método de mapa. funciona perfectamente, pero veo en la consola y me gusta este error. Como arreglarlo

 <div className="priceCal flex flex-col items-center"> <p style={{ fontSize: '1.5em' }} className='font-medium pt-3'>Total items: </p> { data.map((v, i)=>{ return <p className='font-bold text-xl'>Rs. {v.DiscountPrice}</p> }) } </div>

Click para ver el error

 react-jsx-dev-runtime.development.js:117 Warning: Each child in a list should have a unique "key" prop. Check the render method of `Cart`. See https://reactjs.org/link/warning-keys for more information. at p at Cart (http://localhost:3000/static/js/bundle.js:3393:74) at Routes (http://localhost:3000/static/js/bundle.js:63733:5) at RouterMenu at App (http://localhost:3000/static/js/bundle.js:140:81) at Router (http://localhost:3000/static/js/bundle.js:63666:15) at BrowserRouter (http://localhost:3000/static/js/bundle.js:63146:5)
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Debe agregar una clave al elemento principal de la devolución como esta

 return <p className='font-bold text-xl' key={i}>Rs. {v.DiscountPrice}</p>

Pero es mejor usar una propiedad única del objeto como key={v.id} si existe id

about 4 years ago · Juan Pablo Isaza Report

0

estás dando vueltas

 data.map((v, i)=>{ return <p className='font-bold text-xl'>Rs. {v.DiscountPrice}</p> })

Simplemente agregue una clave al JSX de retorno

 data.map((v, i)=>{ return <p key={i} className='font-bold text-xl'>Rs. {v.DiscountPrice}</p> })

Si tiene un identificador único en el objeto v, utilícelo

Consulte => https://reactjs.org/docs/lists-and-keys.html#keys

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!