Reactjs 为什么div闪烁?

Reactjs 为什么div闪烁?,reactjs,react-virtualized,Reactjs,React Virtualized,我是新来的React Virtualized,很抱歉我的英语不好。 这是我的代码笔链接:, 当我滚动到第四个div时,它在闪烁,有人能帮我吗?您忘记接受并设置了style参数。此参数对于react虚拟化非常重要,因为它是在向下滚动时定位行的参数。这是您的渲染函数,已修复: renderPage({index, key, style}) { const color = ['green', 'red', 'black', 'yellow'][index % 4] return (

我是新来的
React Virtualized
,很抱歉我的英语不好。 这是我的代码笔链接:,
当我滚动到第四个div时,它在闪烁,有人能帮我吗?

您忘记接受并设置了
style
参数。此参数对于react虚拟化非常重要,因为它是在向下滚动时定位行的参数。这是您的渲染函数,已修复:

  renderPage({index, key, style}) {
    const color = ['green', 'red', 'black', 'yellow'][index % 4]
    return (
      <div
        style={{ ...style, width: 400, height: 200, backgroundColor: color }}
        key={key}
      >
        No.{index + 1}
      </div>
    )
  }
renderPage({index,key,style}){
常量颜色=[“绿色”、“红色”、“黑色”、“黄色”][索引%4]
返回(
编号{index+1}
)
}