---
order: 6
title:
zh-CN: 无限加载
en-US: infinite load
---
## zh-CN
无限加载样例。
## en-US
The example of infinite load.
````jsx
import { List, Card, message } from 'antd';
let countId = 1;
function mockData() {
const data = [];
for (let i = 0; i < 5; i++) {
const id = countId;
data.push({
id: `id-${id}`,
title: `List Item Title ${id}`,
content: `List Item Content ${id}`,
});
countId++;
}
return data;
}
class InfiniteList extends React.Component {
state = {
data: mockData(),
loading: false,
}
handleInfiniteOnLoad = (done) => {
let data = this.state.data;
if (data.length > 15) {
message.warning('Loaded All');
return;
}
this.setState({
loading: true,
});
setTimeout(() => {
data = data.concat(mockData());
this.setState({
data,
loading: false,
});
// reset the infinite onLoad callback flag
// so can trigger onLoad callback again
done();
}, 1000);
}
render() {
return (
{
this.state.data.map(item => (
{item.content}
))
}
);
}
}
ReactDOM.render(, mountNode);
````