Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda