react-window 元素类型无效:预期为字符串对于内置组件或类/函数对于复合组件但得到:对象

问题描述

我正在使用 react-window 尝试生成一个列表。

使用他们使用的默认行,他们创建

const Row = ({ index,style }) => (
    <div className={index % 2 ? 'ListItemOdd' : 'ListItemEven'} style={style}>
        Row {index}
    </div>
);

然后他们使用默认元素像这样创建列表

  <List
    className="List"
    height={150}
    itemCount={1000}
    itemSize={35}
    width={300}
  >
    {Row}
  </List>

返回的也是一个对象,和我的一样

console output of element

我正在尝试做大致相同的事情。

我正在使用列表组件

<List
      className="List"
      height={150}
      itemCount={20}
      itemSize={35}
      width={300}>
            {renderUsers(users)}
</List>

其中 renderUsers(users) 输出 const renderUsers = map((user) => <User user={user} key={user.__id} />);

我收到一条错误消息

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of `List`.

返回的是一个看起来像这样的对象(问题?)

image of the console output

我该如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)