<div id='app'></div>
class Users extends React.Component {
render() {
return (
<div>
<h1>Friends</h1>
<ul>
{this.props.list.map(function(person) {
if(person.friend) {
return <li>{person.name}</li>
}
})}
</ul>
<hr />
<h1> Non Friends </h1>
<ul>
{this.props.list.map(function(person) {
if(!person.friend) {
return <li>{person.name}</li>
}
})}
</ul>
</div>
)
}
}
ReactDOM.render(
<Users list={[
{ name: 'Tyler', friend: true },
{ name: 'Ryan', friend: true },
{ name: 'Michael', friend: false },
{ name: 'Mikenzi', friend: false },
{ name: 'Jessica', friend: true },
{ name: 'Dan', friend: false } ]}
/>,
document.getElementById('app')
);
View Compiled
This Pen doesn't use any external CSS resources.