Created
November 2, 2016 19:35
-
-
Save mjackson/8b380f12df309aa00d0f278b1f0a5119 to your computer and use it in GitHub Desktop.
Nested ternaries work like if/else if/else for JSX
This file contains 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 element = ( | |
<div> | |
{currentPage === 'signin' ? ( | |
<SignInPage/> | |
) : currentPage === 'welcome' ? ( | |
<WelcomePage/> | |
) : currentPage === 'about' ? ( | |
<AboutPage/> | |
) : ( | |
<DefaultPage/> | |
)} | |
</div> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👏🏻