Element type is invalid Check the render method of `AutoSizer`.
JinJieTan opened this issue · comments
Peter Tan commented
The code is here, but I just report an error , Did I make a mistake? Can you tell me
代码如下,就是会报错:
Element type is invalid ,
import React from 'react';
import { DynamicSizeList as List } from 'react-window';
import AutoSizer from 'react-virtualized-auto-sizer';
const Row = ({ data, index, style }) => (
<div className={index % 2 ? 'ListItemOdd' : 'ListItemEven'} style={style}>
{index}
</div>
);
class App extends React.PureComponent{
render(){
return (
<AutoSizer>
{({ width, height }) => (
<List
width={width}
height={height}
className="msgList"
itemCount={20}
>
{Row}
</List>
)}
</AutoSizer>
)
}
}
export default App;
Peter Tan commented