Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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