Created
March 21, 2020 16:31
-
-
Save DJanoskova/6528a58e9c6a8d31bd1c4649cd2b31e8 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 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