bvaughn / react-virtualized-auto-sizer

Standalone version of the AutoSizer component from react-virtualized

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Element type is invalid Check the render method of `AutoSizer`.

JinJieTan opened this issue · comments

The code is here, but I just report an error , Did I make a mistake? Can you tell me
代码如下,就是会报错:

Element type is invalid ,

image

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;

The link you gave me before, the code in it runs very strange

https://codesandbox.io/s/5x8vlm0o7n

image