0

这是我的渲染方法:

  render: function() {
    var rows = this.state.users;
     return (
        <div className="container">
            <dl className="row">
                <div className="col-md-12">
                    <Table
                        rowHeight={50}
                        rowsCount={rows.length}
                        width={800}
                        height={500}
                        headerHeight={50}>
                        <Column
                            header={<Cell>First Name</Cell>}
                            cell={(_.map(rows, function(row) {
                                return <Cell key={row.id}>{row.firstname}</Cell>;
                            }))}
                            width={200}
                        />
                    </Table>
                    <button type="button" onClick={this.formPopup}>Add User</button>
                </div>
            </dl>
        </div>
    );

为什么视图仍然显示重复?这是完整代码的链接:https ://github.com/DannyGarciaMartin/react-webpack/blob/master/js/source/comp/UserView.jsx

我不明白。我的映射不应该与输入为固定数据表呈现的内容区分开来吗?

这是一张图片作为钥匙不起作用的证明......

在此处输入图像描述

4

1 回答 1

1

cellprop 应该是一个节点或一个函数,有关更多详细信息,请参阅此内容

所以,改变cell

cell={props => (
        <Cell {...props}>
          {rows[props.rowIndex].firstname}
        </Cell>
      )}
于 2017-03-18T03:50:32.303 回答