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

120
Views
No se pueden leer las propiedades de undefined (leyendo 'etiqueta') en reaccionar js

 //this my sector sectors:[ {label: 'bb', key: 0, value: 0} {label: 'aa', key: 33, value: 33} {...} ]

Escribo código para contar duplicados en un objeto, pero tengo un problema en la última sección de mapeo, aparece este error: No se pueden leer las propiedades de undefined (leyendo 'etiqueta') en react js

 // this is my finalArray that I log finalArray:[ {cs: '44', count: 55} {cs: '56', count: 47} {cs: '43', count: 41} {cs: '27', count: 40} {cs: '42', count: 36} {cs: '53', count: 35} {cs: '34', count: 32} {cs: '70', count: 31} {cs: '66', count: 22} {cs: '54', count: 21} ] // this is my code const prepareSeries = (data, sectors) => { let finalArray = []; const countsByCs = {}; data.forEach(({ cs }) => { countsByCs[cs] = (countsByCs[cs] || 0) + 1; }); finalArray = Object.entries(countsByCs) .map(([cs, count]) => ({ cs, count })) .sort((a, b) => b.count - a.count) .slice(0, 10); console.log(finalArray); return [ { data: finalArray.map((item) => { return { name: sectors.filter((sector) => sector.key == item[0])[0].label, y: item[1] }; }), }, ]; };

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intenta usar el siguiente código

 return { name: sectors.filter((sector) => sector.key == item[0]).label, y: item[1] }
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!