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

254
Views
¿Cómo verificar que mis datos se hayan pasado a la variable antes de que se representen? (useRef)

Tengo este botón que aparece solo cuando su texto desborda su contenedor principal. Hasta ahora funciona, pero cuando voy a actualizar la página, aparece un error tipográfico de "No se pueden leer las propiedades de undefined (leyendo 'clientHeight')".

Creo que esto se debe a que mi variable el no ha terminado de extraer mis datos de mi useRef. ¿Cómo puedo verificar que mi variable haya pasado en mis datos con éxito antes de que se represente?

 const inputRef = useRef<HTMLDivElement>() const checkOverflowing = () => { const el = inputRef.current const isOverflowing = el.clientHeight < el.scrollHeight return isOverflowing } return ( <div ref={inputRef} className="comment-for-user">{review.comments}</div> <div className="show-more-360"> {checkOverflowing() && <button className="show-more-button" onClick={handleEvent}>...show More</button>} </div>)
about 4 years ago · Santiago Gelvez
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!