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

135
Views
Calcule la altura y muestre el contenido de ViewMore según el contenido de los elementos de la lista en React js

Tengo una matriz dinámica que proviene del servidor y necesito configurar el enlace viewMore cuando la altura del elemento es mayor que cierta altura. Esta vistaMás contenido debe mostrarse así.

 <div id={`_message_detail_list${id}`}> <ul style={{ "max-height": valListMaxHeight }}>{listItems}</ul> <div> {viewMoreText (here i need to add another condition to check height of ul is greater than some threshold) && ( <div> <a id={`_primaryAction_${id}`} href="#" data-key={id} onClick={this.handleClick}> {viewMoreText} </a> </div>

¿Es posible calcular la altura y mostrar otro elemento basado en esta altura?

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

0

Puede usar una referencia en combinación con clientHeight así:

 const ulElementRef = useRef(null); const ulHeight = elementRef.current?.clientHeight; //... <ul ref={ulElementRef} style={{ "max-height": valListMaxHeight }}>{listItems}</ul>

Entonces puede usar ulHeight para su condición.

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!