Last active
April 6, 2021 05:37
-
-
Save myogeshchavan97/a0e980af23f70b85af7c360c83569f88 to your computer and use it in GitHub Desktop.
Updated UsersList
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
import React from 'react'; | |
import UserItem from './UserItem'; | |
import UserContext from '../context/UserContext'; | |
const UsersList = () => { | |
return ( | |
<UserContext.Consumer> | |
{({ isLoading, users }) => ( | |
<div className="users-list"> | |
{isLoading ? ( | |
<p className="loading">Loading...</p> | |
) : ( | |
<React.Fragment> | |
{users.map((user, index) => ( | |
<UserItem key={index} {...user} /> | |
))} | |
</React.Fragment> | |
)} | |
</div> | |
)} | |
</UserContext.Consumer> | |
); | |
}; | |
export default UsersList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment