mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 12:16:38 +08:00
* Add type definitions for `react-lazyload` package. * fix lint error. * fix TypeScript Version
33 lines
813 B
TypeScript
33 lines
813 B
TypeScript
import * as React from "react";
|
|
import LazyLoad from "react-lazyload";
|
|
|
|
interface State {
|
|
arr: string[];
|
|
}
|
|
|
|
class Normal extends React.Component<{}, State> {
|
|
constructor() {
|
|
super();
|
|
let arr: string[] = [];
|
|
for (let i = 0; i < 200; i++) {
|
|
arr.push(`${i}`);
|
|
}
|
|
this.state = { arr };
|
|
}
|
|
render() {
|
|
return (
|
|
<div>
|
|
{this.state.arr.map((el, index) => {
|
|
return (
|
|
<LazyLoad once={true} key={index} height={200} offset={50}>
|
|
<p id={`${index}`} >
|
|
count={index + 1}
|
|
</p>
|
|
</LazyLoad>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|
|
}
|