我需要一点帮助以下内容。谁能告诉我这里做错了什么?当我从渲染中调用renderRow时,我没有得到输出。谢谢!
renderRow() {
const { Row, Cell } = Table;
return this.props.registeredAccounts.map(address => {
return
<Row>
<Cell>{address}</Cell>
<Cell>minimum payment</Cell>
</Row>
})
}
render(){
const { Header, Row, HeaderCell, Body } = Table;
return (
<Layout>
<h3>Registered Accounts</h3>
<Table>
<Header>
<Row>
<HeaderCell>Address</HeaderCell>
<HeaderCell>Minimum Payment</HeaderCell>
</Row>
</Header>
<Body>
{this.renderRow()}
</Body>
</Table>
</Layout>
)
}
答案 0 :(得分:0)
这是因为您在一行上使用了return
。将html包装在括号中,或将<Row>
标记移至return
行。就像现在一样,你实际上是在返回null
。
renderRow() {
const { Row, Cell } = Table;
return this.props.registeredAccounts.map(address => {
return (
<Row>
<Cell>{address}</Cell>
<Cell>minimum payment</Cell>
</Row>
)
})
}