-
-
Save garethpbk/9519dd61f9fa3a928424ff48f6e18cdf to your computer and use it in GitHub Desktop.
This file contains 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
const AllUsers = () => ( | |
<> | |
<h2>Current Users</h2> | |
<ul> | |
<li> | |
<em>User Name, User Email, User Id</em> | |
</li> | |
<Query query={GET_ALL_USERS_QUERY}> | |
{({ data, error, loading }) => { | |
if (loading) return <li>Loading...</li>; | |
if (error) return <li>{`Error! ${error}`}</li>; | |
return data.users.map(user => { | |
const { name, email, id } = user; | |
return ( | |
<li key={email}> | |
<Link to={`/${id}`}>{`${name}, ${email}, ${id}`}</Link> | |
</li> | |
); | |
}); | |
}} | |
</Query> | |
</ul> | |
</> | |
); | |
export default AllUsers; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment