Created
March 21, 2020 16:39
-
-
Save DJanoskova/e945de6521eb9bec3df3d065da002301 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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