Skip to content

Instantly share code, notes, and snippets.

@myogeshchavan97
Last active April 6, 2021 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myogeshchavan97/a0e980af23f70b85af7c360c83569f88 to your computer and use it in GitHub Desktop.
Save myogeshchavan97/a0e980af23f70b85af7c360c83569f88 to your computer and use it in GitHub Desktop.
Updated UsersList
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