1 回答

TA貢獻1805條經驗 獲得超9個贊
我認為您可以簡化事情,您可以在您的子組件上嘗試以下代碼嗎?
class UsersTable extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<TableBody>
{data
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map(n => {
return (
<TableRow key={n.id}>
<TableCell className={classes.fixedTd}>
<BorderColorIcon onClick={() => this.props.userId(n.userId)} className="action margin-r" />
</TableCell>
</TableRow>
);
})}
</TableBody>
);
}
}
export UsersTable;
添加回答
舉報