Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

185
Vistas
How to dynamically size distinct row columns in React to be the same

I have a table structure which is made out of distinct blocks which cannot be brought into the same block, such as this - only much larger.

The structure of this ideally needs to stay the same.

<div class="dynamicList">
   <div class="header">
      <div class="item">col1</div>
      <div class="item">col2</div>
   </div>
   <div class="row">
      <div class="item">Learn JavaScript</div>
      <div class="item">test message</div>
   </div>
   <div class="row">
      <div class="item">Build something awesome</div>
      <div class="item">medium message</div>
   </div>
</div>

I want a way to be able to dynamically size the columns in the row to auto fit to the text so that the largest text column width is used for all the others of the same column. On the top is how it looks, at the bottom is how I want it to look.

enter image description here

I was hoping I could get away with just using CSS for this, however I feel I might need some JavaScript too. I am using React, so thought about using useRef hook, but didn't know how well this would perform with a really large table.

What is the best way to calculate this width and then use it across all columns of the same index?

Here is a JS fiddle showing the problem.

https://jsfiddle.net/og8kz3hp/65/

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda