Forked from Maruz/gist:9274096e436f83e59524bdd09b6cc030
Last active
August 17, 2017 13:34
-
-
Save adrianolsk/c0136f483e7c7ac150fc310b01ccb7b8 to your computer and use it in GitHub Desktop.
React conditional component rendering
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
<nav className='navbar'> | |
{ | |
userRole === 'admin' && ( | |
<AdminPanel /> | |
) || userRole === 'user' && ( | |
<UserPanel /> | |
) || ( | |
<StatusPanel /> | |
) | |
} | |
</nav> | |
more options on https://www.robinwieruch.de/conditional-rendering-react/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment