我正在尝试使用react-virtualized,并且我在开始时遇到了很多麻烦。文档非常稀少。
我正在尝试使用以下示例:
import { Grid, List, ScrollSync } from 'react-virtualized'
import 'react-virtualized/styles.css'; // only needs to be imported once
function render (props) {
return (
<ScrollSync>
{({ clientHeight, clientWidth, onScroll, scrollHeight, scrollLeft, scrollTop, scrollWidth }) => (
<div className='Table'>
<div className='LeftColumn'>
<List
scrollTop={scrollTop}
{...props}
/>
</div>
<div className='RightColumn'>
<Grid
onScroll={onScroll}
{...props}
/>
</div>
</div>
)}
</ScrollSync>
)
}
我将它放在一个单独的.tsx文件中。然后我尝试在以下组件中使用它:
export class Container extends React.Component<any, any>{
constructor(props: any) {
super(props);
this.state = {
modal: this.props.name,
};
}
public render() {
return <div>
<div className="grid2" >
<div className="containdiv">
//I want it here
</div >
</div >
</div>
}
}
任何更熟悉打字稿和反应虚拟化的人都有一个想法,我怎么能让这个工作?或者有任何我无法找到的秘密文件?