我很好奇如何遍历数组并将结果附加到反应组件。 我已经完成了对一系列对象进行排序并抓住我想要的帐户的部分。现在我不确定如何将它们附加到html。
export default class SortedTeams extends React.Component {
renderContent(content){
var entries = [{fullname: 'foo', title: 'designer'}, {fullname:
'foo2',
title: 'designer'}, {fullname: 'foo3', title: 'developer'}]
var nohit = [];
for(var i = 0; i <= entries.length - 1; i++) {
if(entries[i].title === 'designer'){
console.log('foohit');
}
else{
nohit.push('nope')
}
}
render() {
var content = this.props.block.content;
return(
<SiteBuilderBlock tag="section" className="sortedTeams" block={this.props.block}>
<div>
<SiteBuilderList tag="div" list="teams" inGroupsOf={4} inGroupsOfClassName="row">
{(element, key) => this.renderContent(element, key)}
</SiteBuilderList>
</div>
</SiteBuilderBlock>
);
}
}