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

368
Visualizações
What is the best way to deal with forced DOM operations with React?

let me explain what I am dealing with:

I have a small app that looks like this:

I have 3 components: an input of type time, a slider, and a table with some transactions (each of them having a timestamp)

When I slide the slider, the input time changes accordingly.

When I change the input time, the slider changes position accordingly

enter image description here

Now, my goal is that:

when I change the input/slider position to a certain time,

then I scroll the table of an amount such that the entry which timestamp is the closest to the selected time is scrolled to the top of the table viewport


My current idea is to:

  1. using the value from the slider/input, find the transaction which time is the closest to the one selected
  2. find the index of this transaction in the array
  3. calculate how many pixels I should scroll down with row_height * index+1
  4. perform DOM manipulation to scroll the table

But I realize I am not used to perform DOM manipulation in React, so I was wondering:

is there a better approach the the one I proposed?

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