Created
November 5, 2016 07:31
-
-
Save smhatre59/69ecb86d9aaf7380e858d0ec58427a61 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import User from './User.js'; | |
export default class UserList extends React.Component{ | |
render(){ | |
if(Object.getOwnPropertyNames(this.props.users).length === 0){ | |
return (<div></div>) | |
} | |
var userNodes = this.props.users.map(function(user){ | |
return ( | |
<User firstname={user.first_name} lastname={user.last_name} | |
key={user.id} avatar={user.avatar}> | |
{user.first_name} | |
</User> | |
) | |
}) | |
return ( | |
<div> | |
<center> | |
<h1 className="user-profile">User Profiles</h1> | |
{userNodes} | |
</center> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment