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

225
Views
Cambiar el tamaño de un <div> con el valor de los datos obtenidos

Estoy obteniendo datos de una API y muestro algunos accesorios de ellos usando el mapeo y quiero cambiar el ancho de acuerdo con el valor de los accesorios.

 <h5> <span className="viewcount" ref={boxSize}> {`View Count: ${item.statistics.viewCount}`}</span> </h5>

Por ejemplo, este es un accesorio llamado "recuento de vistas" del elemento API, y quiero que el ancho de este componente sea de 200 px cuando el accesorio de recuento de vistas es un número de 200. ¿Cómo puedo lograrlo?

PD: Estoy usando reaccionar.

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

0

 150 is the default width <h5> <span className="viewcount" ref={boxSize} style={{width: item.statistics.viewCount===200 ? 200: 150}}> {`View Count: ${item.statistics.viewCount}`}</span> </h5> OR if you want to always set the value of viewCount as the width <h5> <span className="viewcount" ref={boxSize} style={{width: item.statistics.viewCount}}> {`View Count: ${item.statistics.viewCount}`}</span> </h5>

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!