我正在尝试根据数据列表呈现组件。数据列表包括地址和记录列表,在每个地址记录中,它包含一个或多个成员记录。数据结构如下所示:
combineData:[
addressData:{addressNo:... },
memberDataList:[{...}]
]
我想这样渲染:
<address1>
<member1 of address 1>
<member2 of address 1>
<address2>
<member1 of address 2>
<member2 of address 2>
<member3 of address 2>
......
class AddressMembersTable extends React.Component {
addressMembersViews = () => this.props.combineData.map((combineData, index) => {
return (
<Container layout="vbox">
<AddressField
ref={'addressField'}
key={'addressField'}
addressData={combineData.addressData}
/>
{combineData.memberDataList.forEach((memberData,index)=>{
return(
<MemberField
ref={'memberField_' + index}
memberData = {combineData.memberDataList}
/>
)
})}
</Container>
)
})}
我试图为 MemberField 组件循环 memberDataList,但只有 AddressField 能够显示。如何正确渲染组件?