In this lesson we'll show how to use the AutoSizer component from react-virtualized to automatically measure the width/height of our content area. We'll then use theList component to render our set of data as a virtualized list into the DOM using windowing.

Install:

npm install --save react-vistualized
import React, {Component} from 'react';
import {AutoSizer, List} from 'react-virtualized'; const ScreenInfo = ({width, height}) => (<span>width: {width} height: {height}</span>); class App extends Component { renderRow = ({key, isScrolling, style, index}) => {
return (
<div style={style} key={key}>
name: {this.props.data[index].name}
email: {this.props.data[index].email}
</div>
);
}; render() {
return (
<AutoSizer>
{({width, height}) => {
return (
<div>
<ScreenInfo width={width} height={height}/>
<List
rowCount={this.props.data.length}
rowHeight={50}
rowRenderer={this.renderRow}
width={width}
height={height}
/> </div>
);
}}
</AutoSizer>
);
}
} export default App;

最新文章

  1. nginx配置之取消index.php同时不影响js,css功能
  2. 学习网页制作中如何在正确选取和使用 CSS 单位
  3. Subgraph Search Over Large Graph Database
  4. Linux- Bond
  5. SQLServer2005:在执行批处理时出现错误。错误消息为: 目录名无效
  6. Contest1065 - 第四届“图灵杯”NEUQ-ACM程序设计竞赛(个人赛)H吃薯条
  7. JavaScript中的EcMAScript学习笔记
  8. Spring读取外部属性-properties
  9. Selenium中三种等待的使用方式---规避网络延迟、代码不稳定问题
  10. 【LOJ#6060】Set(线性基)
  11. DotNet 资源大全中文版
  12. CentOS_mini下make安装
  13. maven(九),install安装到本地仓库
  14. easyui-switchbutton js判断是否启动
  15. redflag的echarts结构
  16. Linux下动态链接库加载路径
  17. window.onbeforeunload() 事件调用ajax
  18. 第一篇 Python图片处理模块PIL(pillow)
  19. 网络性能测试工具iperf详细使用图文教程(转)
  20. 数据结构&amp;堆&amp;heap&amp;priority_queue&amp;实现

热门文章

  1. OpenCV特征点检测&mdash;&mdash;ORB特征
  2. mvn本地执行java程序
  3. 关于vue.js中v-model与表单控件的双向绑定。
  4. DockerUI(图形化管理)
  5. telint---切换当前正在运行的Linux系统的运行等级
  6. 谈谈Spine动画在产品中的应用
  7. UVALive 6527 Counting ones dfs(水
  8. Day4上午解题报告
  9. HDU 2333 Assemble(二分)
  10. 一个理性战胜感性的成功案例:P2P投资和活期理财,纠结中提炼出来的1个数学问题