Skip to content

Instantly share code, notes, and snippets.

@DJanoskova
Created March 21, 2020 16:31
Show Gist options
  • Select an option

  • Save DJanoskova/6528a58e9c6a8d31bd1c4649cd2b31e8 to your computer and use it in GitHub Desktop.

Select an option

Save DJanoskova/6528a58e9c6a8d31bd1c4649cd2b31e8 to your computer and use it in GitHub Desktop.
const UserCard = ({ user }) => {
const getUserRole = () => {
const { roles } = user;
if (roles.includes('admin')) return 'Admin';
if (roles.includes('maintainer')) return 'Maintainer';
return 'Developer';
}
return (
<ul>
<li>{user.name}</li>
<li>{user.age}</li>
<li>{user.email}</li>
<li>{getUserRole()}</li>
</ul>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment