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

249
Visualizações
Simple List example using react-virtualized

I'm trying to get a very simple example of "react-virtualized" to work using the "List" method of display.

Here's what I have so far (omitting html/css here because it's trivial, see codepen for complete example):

https://codepen.io/darrengates/pen/eYMRbGr

const { List } = ReactVirtualized
const generateRandomItem = (idx) => ({
   id: idx,
   name: faker.name.findName()
})

class App extends React.Component {
   constructor () {
      super()
      this.renderRow = this.renderRow.bind(this)
      
      // fake data
      let items = []
      for (let i = 0, l = 1000; i < l; i++) {
         items.push(generateRandomItem(i))
      }
      this.state = {
         items: items
      }
   }
   
   renderRow({index, key}) {
      const item = this.state.items[index];
      return (
           <div>{item.name}</div>
      )
   }
   
   render () {      
      return (
         <div class="container">
            <h1>List Example</h1>
            <List
               width={600}
               height={300}
               rowHeight={40}
               rowCount={this.state.items.length}
               rowRenderer={this.renderRow}
            ></List>
         </div>
      )
   }
}

ReactDOM.render(
  <App />,
  document.getElementById('app')
)

If you start scrolling down the list, you'll soon see that data "farther down" the list does not appear in the container as it should - I only see white space where there should be additional rows of data.

This seems like the simplest possible example of React Virtualized using List. What am I doing wrong in this very simple example?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You aren't passing the style parameter provided by the rowRenderer function:

 renderRow({index, key, style}) {
      const item = this.state.items[index];
      return (
           <div style={style}>{item.name}</div>
      )
   }
about 4 years ago · Santiago Trujillo Relatório
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